1. Full backup database PRODrun {allocatechannelc1devicetypedisk; allocatechannelc2devicetypedisk; backuptag
1. Full backup database PROD run {allocate channel c1 device type disk; allocate channel c2 device type disk; backup tag
1. Full backup database PROD
Run {
Allocate channel c1 device type disk;
Allocate channel c2 device type disk;
Backup tag 'sh _ db' as compressed backupset format'/home/Oracle/full _ % U. Bak' database
Include current controlfile;
Backup tag 'sh _ ARCH 'archivelog al format'/home/oracle/arch _ % U. bak' l;
Release channel c1;
Release channel c2;
}
2. Confirm the backup part of the control file.
RMAN> list backup of control file;
/Home/oracle/full_03pkgtf4_1_1.bak
3. Export pfile and change the control file to + DATA and + FRA.
SYS @ PROD> create pfile = '/home/oracle/prodpfile' from spfile;
[Oracle @ single ~] $ Vi/home/oracle/prodpfile
*. Audit_file_dest = '/u01/admin/PROD/adump'
*. Audit_trail = 'db'
*. Compatible = '11. 2.0.4.0'
# *. Control_files = '/u01/oradata/PROD/control01.ctl', '/u01/fast_recovery_area/PROD/control02.ctl'
*. Control_files = '+ DATA/PROD/controlfile/control01.ctl', '+ FRA/PROD/controlfile/control02.ctl'
*. Db_block_size = 8192
*. Db_create_file_dest = '+ data'
*. Db_domain =''
*. Db_name = 'prod'
# *. Db_recovery_file_dest = '/u01/fast_recovery_area'
*. Db_recovery_file_dest = '+ fra'
*. Db_recovery_file_dest_size = 4385144832
*. Diagnostic_dest = '/u01'
*. Dispatchers = '(PROTOCOL = TCP) (SERVICE = PRODXDB )'
*. Log_archive_format = '% t _ % s _ % r. dbf'
*. Memory_target = 583008256
*. Open_cursors = 300
*. Processses = 150
*. Remote_login_passwordfile = 'clusive'
*. Undo_tablespace = 'undotbs1'
4. Delete PROD
SYS @ PROD> startup force mount restrict;
SYS @ PROD> drop database;
5. Create the directory required for disaster recovery (this step is required for DBCA to delete the database)
Mkdir-p $ ORACLE_BASE/admin/PROD/adump
6. Create a database password file (this step is required for DBCA to delete the database)
Orapwd file = $ ORACLE_HOME/dbs/orapwPROD password = oracle entries = 5 force = y
7. Start nomount with the modified pfile
$ Sqlplus/as sysdba
SYS @ PROD> startup nomount pfile =/home/oracle/pfile;
8. Create the spfile file to the + DATA directory and use the new Oracle11g feature from memory
SYS @ PROD> create spfile = '+ DATA/PROD/spfilePROD. ora' from memory;
9. Create a pfile to point to spfile. Fill in the red font content in the pfile File Created by vi. This configuration is required for cluster software installed in Oracle11g, whether it is single instance ASM or RAC + ASM
SYS @ PROD>! Vi $ ORACLE_HOME/dbs/initPROD. ora
SPFILE = '+ DATA/PROD/spfilePROD. ora'
10. Restore the control file to + DATA
RMAN> startup force nomount;
RMAN> restore controlfile from '/home/oracle/full_03pkgtf4_00001.bak ';
11. Start to mount
RMAN> mount database;
12. Identify backup Sets
RMAN> catalog start with '/home/oracle /';
13. Recover the database. The key words set newname and switch datafile all are the key to migrating the file system to ASM.
Run {
Set newname for datafile 1 to '+ data ';
Set newname for datafile 2 to '+ data ';
Set newname for datafile 3 to '+ data ';
Set newname for datafile 4 to '+ data ';
Set newname for tempfile 1 to '+ data ';
Restore database;
Switch datafile all;
Recover database;
}
14. Change the online Log Path to + DATA
SYS @ PROD> alter database rename file '/u01/oradata/PROD/redo01.log' to '+ data ';
SYS @ PROD> alter database rename file '/u01/oradata/PROD/redo02.log' to '+ data ';
SYS @ PROD> alter database rename file '/u01/oradata/PROD/redo03.log' to '+ data ';
15. open resetlogs
SYS @ PROD> alter database open resetlogs;
16. If the migration of tempfile fails in the set newname tempfile step, use the following command to manually append the file
SYS @ PROD> alter tablespace temp add tempfile '+ data' size 10 m;
SYS @ PROD> alter tablespace temp drop tempfile '/u01/oradata/PROD/temp01.dbf ';
Lab ended
-------------------------------------- Recommended reading --------------------------------------
RMAN: Configure an archive log deletion policy
Basic Oracle tutorial-copying a database through RMAN
Reference for RMAN backup policy formulation
RMAN backup learning notes
Oracle Database Backup encryption RMAN Encryption
-------------------------------------- Split line --------------------------------------