Hot Backup:
For this we need to store archive logs.
Here we are doing backup for PROD databases which is stored in /u01/app/oracle/PROD.
STEP 1: LOGIN TO SQL USING PROD.
[oracle@localhost ~]$ . oraenv
SQL > startup
SQL > archive log list
STEP2: Here we need to change the archive destination.
So add a directory and change the location in next steps. (The location of the directory is /u01/app/oracle/oradata/archivelogs)
STEP 3: If it is disabled we need to enable. For this follow the steps.
SQL> shutdown
SQL> startup mount
SQL>alter database archivelog
STEP4: Run this query and check all are in ONLINE mode.
SQL> alter database open;
SQL> Select file_name, tablespace_name, online_status from dba_data_files;
STEP 5: we need to open the database.
SQL> alter database open;
STEP 6: We need to create one directory to store all the backup files. Normally I will create this directory in /home/oracle/backupfiles/PROD. Here I will add backupfiles/PROD.
STEP 7: Run this query.
SQL> SELECT 'ALTER TABLESPACE ' || TABLESPACE_NAME || ' BEGIN BACKUP; ' FROM DBA_TABLESPACES WHERE TABLESPACE_NAME NOT LIKE '%TEMP%';
STEP 8: Copy and paste the result from the above query and run at sql prompt to put dbf in back up mode.
STEP 9: Now we need to copy all the *.dbf files which are located in /u01/app/oracle/oradata/PROD/*.dbf to /home/oracle/backups/PROD/
STEP 9: Run this query.
SQL> select 'alter tablespace ' || tablespace_name || ' end backup; ' from dba_tablespaces where tablespace_name not like 'TEMP%';
STEP 10: Copy and paste the result from the above query and run at sql prompt.
STEP 11: Run this query.
SQL> alter system archive log current;
STEP 12: Run this query.
SQL> alter database backup controlfile to ‘/home/oracle/backups/PROD/prod_ctl.ctl’
This will copy the control file to the destination.
STEP 13: Run this query.
SQL> alter database backup controlfile to trace;
STEP14: This will create a backup control file to trace.
This will store /u01/app/oracle/PROD/admin/PROD/udump/
[oracle@localhost ~]$ ls –ltr
gives list of files in this directory.
Copy the last file to /home/oracle/backups/PROD/
[oracle@localhost ~]$ cp prod_ora_7811.trc /home/oracle/backups/PROD/prod_ctl.txt
[NOTE: Save this .trc file as .txt file.]
No comments:
Post a Comment