1. View the main library Zdjs and use Rmam for backup
[Email protected] ~]$ Sqlplus'/as sysdba'SQL*plus:release10.2.0.1.0-Production on Wed Jan - -: -: - -Copyright (c)1982,2005, Oracle. All rights reserved. Connected to an idle instance. SQL>Startuporacle instance started. Total System Global Area608174080bytesfixed Size1220820bytesvariable Size159387436Bytesdatabase Buffers440401920Bytesredo Buffers7163904bytesdatabase mounted. Database opened.
Sql>Show parameter NameName TYPE VALUE------------------------------------ ----------- ------------------------------Db_file_name_convertstringdb_namestringZdjsdb_unique_namestringZdjsglobal_names Boolean Falseinstance_namestringZdjslock_name_spacestringLog_file_name_convertstringService_namesstringZdjs
[[email protected] ~]$ Rman target/Recovery manager:release10.2.0.1.0-Production on Wed Jan - -: -: - -Copyright (c)1982,2005, Oracle. All rights reserved.connected to target Database:zdjs (DBID=3486931402) RMAN>Run {2>Allocate channel C1 type disk;3>Allocate channel C2 type disk;4> Backup full database format'/u01/rman_bak/%d_%s_%t.bak'; 5> Backup Archivelog all format'/u01/rman_bak/arch_%s.bak';6> Backup Current controlfile format'/u01/rman_bak/ctl_%s.bak';7> }usingTarget Database control file instead of recovery catalogallocated channel:c1channel C1:sid=143Devtype=diskallocated Channel:c2channel C2:sid=142Devtype=diskstarting backup at --jan- theChannel c1:starting full datafile backupsetchannel c1:specifying datafile (s)inchbackupsetinput datafile FNO=00001name=/u02/app/oradata/zdjs/system01.dbfinput datafile FNO=00006name=/u02/app/oradata/zdjs/plat01.dbfinput datafile FNO=00008name=/u02/app/oradata/zdjs/rlsm01.dbfinput datafile FNO=00002name=/u02/app/oradata/zdjs/undotbs01.dbfinput datafile FNO=00004name=/u02/app/oradata/zdjs/Users01.dbfchannel c1:starting piece1At --jan- theChannel c2:starting full datafile backupsetchannel c2:specifying datafile (s)inchbackupsetinput datafile FNO=00003name=/u02/app/oradata/zdjs/sysaux01.dbfinput datafile FNO=00010name=/u02/app/oradata/zdjs/qhrlst01.dbfinput datafile FNO=00005name=/u02/app/oradata/zdjs/example01.dbfinput datafile FNO=00007name=/u02/app/oradata/zdjs/rlst01.dbfinput datafile FNO=00009name=/u02/app/oradata/zdjs/Rlsc01.dbfchannel c2:starting piece1At --jan- theChannel c1:finished piece1At --jan- thepiece handle=/u01/rman_bak/zdjs_6_868976951.bak tag=tag20150114t142911 comment=Nonechannel c1:backupSetComplete, Elapsed time:xx: on: -Channel c1:starting full datafile backupsetchannel c1:specifying datafile (s)inchbackupsetincluding Current Control fileinchBackupsetchannel c1:starting piece1At --jan- theChannel c1:finished piece1At --jan- thepiece handle=/u01/rman_bak/zdjs_8_868977018.bak tag=tag20150114t142911 comment=Nonechannel c1:backupSetComplete, Elapsed time:xx:xx:GenevaChannel c1:starting full datafile backupsetchannel c1:specifying datafile (s)inchbackupsetincluding Current SPFILEinchBackupsetchannel c1:starting piece1At --jan- theChannel c1:finished piece1At --jan- thepiece handle=/u01/rman_bak/zdjs_9_868977021.bak tag=tag20150114t142911 comment=Nonechannel c1:backupSetComplete, Elapsed time:xx:xx: GenevaChannel c2:finished piece1At --jan- thepiece handle=/u01/rman_bak/zdjs_7_868976952.bak tag=tag20150114t142911 comment=Nonechannel c2:backupSetComplete, Elapsed time:xx: on: -finished backup at --jan- thestarting backup at --jan- theCurrent log Archivedchannel c1:starting archive log backupsetchannel c1:specifying archive log (s)inchBackupSetInput Archive Log thread=1Sequence= theRecid=1stamp=868977033Channel c1:starting piece1At --jan- theChannel c1:finished piece1At --jan- thepiece handle=/u01/rman_bak/arch_10.bak tag=tag20150114t143033 comment=Nonechannel c1:backupSetComplete, Elapsed time:xx:xx:Genevafinished backup at --jan- thestarting backup at --jan- theChannel c1:starting full datafile backupsetchannel c1:specifying datafile (s)inchbackupsetincluding Current Control fileinchBackupsetchannel c1:starting piece1At --jan- theChannel c1:finished piece1At --jan- thepiece handle=/u01/rman_bak/ctl_11.bak tag=tag20150114t143038 comment=Nonechannel c1:backupSetComplete, Elapsed time:xx:xx: Genevafinished backup at --jan- thereleased channel:c1released channel:c2
Sql> Col file_name forA50sql>SelectFile_id,file_name,tablespace_name fromDba_data_files; file_id file_name tablespace_name---------- -------------------------------------------------- ------------------------------4/u02/app/oradata/zdjs/users01.dbf USERS3/u02/app/oradata/zdjs/sysaux01.dbf Sysaux2/u02/app/oradata/zdjs/undotbs01.dbf UNDOTBS11/u02/app/oradata/zdjs/system01.dbf SYSTEM5/u02/app/oradata/zdjs/example01.dbf EXAMPLE6/u02/app/oradata/zdjs/plat01.dbf PLAT7/u02/app/oradata/zdjs/rlst01.dbf Rlst8/u02/app/oradata/zdjs/rlsm01.dbf rlsm9/u02/app/oradata/zdjs/rlsc01.dbf RLSCTen/u02/app/oradata/zdjs/qhrlst01.dbf QhrlstTenRows selected.
2. Create a Pfile file
from SPFile; File created.
3. Create a directory of clone libraries
[Email protected] oradata]$ mkdir-p $ORACLE _base/admin/clonedb/-P $ORACLE _base/oradata/clonedb/
4. Generate the pfile of the clone Library from the pfile copy of the main library and generate the password file for the clone library
# #红字部分是修改的部分, the blue Word part needs to be added
[[ Email protected] dbs]$ CP Initzdjs.ora initclonedb.ora[[email protected] dbs]$ VI initclonedb.ora [email protected ] dbs]$ cat Initclonedb.ora*.audit_file_dest= '/u02/app/admin/clonedb/adump ' *.background_dump_dest= '/u02/app/admin/clonedb/bdump '*.compatible='10.2.0.1.0'*.control_files= '/u02/app/oradata/clonedb/control01.ctl ', '/u02/app/oradata/clonedb/control02.ctl ', '/u02/ App/oradata/clonedb/control03.ctl ' *.core_dump_dest= '/u02/app/admin/clonedb/cdump '*.db_block_size=8192*.db_domain="'*.db_file_multiblock_read_count= -*.db_name= ' Clonedb '*.dispatchers='(PROTOCOL=TCP) (SERVICE=ZDJSXDB)'*.job_queue_processes=Ten*.log_archive_dest_1= ' Location=/u01/clonedb_arch '*.open_cursors= -*.pga_aggregate_target=201326592*.processes= Max*.remote_login_passwordfile='EXCLUSIVE'*.sga_target=605028352*.undo_management='AUTO'*.undo_tablespace='UNDOTBS1'*.user_dump_dest= '/u02/app/admin/clonedb/udump 'db_file_name_convert= ("/u02/app/oradata/zdjs", "/u02/app /oradata/clonedb ") log_file_name_convert= ("/u02/app/oradata/zdjs ","/u02/app/oradata/clonedb ")
Example Rman cloning a database on the same machine