Showing posts with label Oracle Administration. Show all posts
Showing posts with label Oracle Administration. Show all posts

Location of ASM tablespace files

Login as "grid"

export ORACLE_HOME=/u01/app/12.1.0/grid --this is also usual installation directory

export ORACLE_SID=+ASM

cd $ORACLE_HOME/bin

./asmcmd -p

ASMCMD>ls
+DATA01
+DATA02
ASMCMD>cd +DATA01

Oracle Data Pump Backup Day Wise

#!/bin/sh

export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1
export BKP_HOME=$ORACLE_BASE/data_pump
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID = oratrg

echo 'Exporting Full Oracle Database Backup....'

expdp hr/hr directory=<directory name> dumpfile=FULL-$(date +%A).dmp logfile=FULL-$(date +%A).log full=y

tar -cvzf $BKP_HOME/FULL-$(date +%A).tar.gz $BKP_HOME/FULL-$(date +%A).dmp
cat $BKP_HOME/FULL-$(date +%A).log

echo 'Transferring Oracle Export Dump file to Remote location ....'

cd $BKP_HOME
smbclient //<Remote_Location>/D$ -U <Windows Domain Name>/<User>%<Password-c "put FULL-$(date +%A).log"
smbclient //<Remote_Location>/D$ -U <Windows Domain Name>/<User>%<Password -c "put FULL-$(date +%A).tar.gz"

Export Database using smbclient

#!/bin/sh

export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1
export BKP_HOME=$ORACLE_BASE/data_pump
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID = oratrg

echo 'Exporting Full Oracle Database Backup....'

expdp hr/hr directory=data_pump dumpfile=full.dmp logfile=full.log reuse_dumpfiles=y full=y

tar -cvzf $BKP_HOME/full.tar.gz $BKP_HOME/full.dmp
cat $BKP_HOME/full.log

echo 'Transferring Oracle Export Dump file to Remote location ....'

cd $BKP_HOME
smbclient //<Remote_Location>/D$ -U <Windows Domain Name>/<User>%<Password -c "put full.dmp"
smbclient //<Remote_Location>/D$ -U <Windows Domain Name>/<User>%<Password-c "put full.log"
smbclient //<Remote_Location>/D$ -U <Windows Domain Name>/<User>%<Password -c "put full.tar.gz"

Move Datafile from Location to Another

Prior to Oracle 12c, moving datafiles has always been an offline task

Oracle 12c includes an enhancement to ALTER DATABASE command to allow datafiles to be moved online

Connect as SYSDBA

SQL>SELECT file_id, file_name FROM dba_data_files ORDER BY file_id;

SQL> ALTER DATABASE MOVE DATAFILE '/u01/app/oracle/oradata/cdb1/system01.dbf'
TO '/tmp/system01.dbf';

Database altered.

SQL> SELECT file_id, file_name FROM dba_data_files WHERE file_id = 1;

How to fix: ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)

Open your terminal and type mysql -u root -p Enter your password. Hopefully your MySQL is logged in now.