首页 > 代码库 > 示例在同一台机器上RMAN克隆数据库
示例在同一台机器上RMAN克隆数据库
1.查看主库ZDJS并使用RMAM进行备份
[oracle@std ~]$ sqlplus ‘/as sysdba‘SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 14 14:13:14 2015Copyright (c) 1982, 2005, Oracle. All rights reserved.Connected to an idle instance.SQL> startupORACLE instance started.Total System Global Area 608174080 bytesFixed Size 1220820 bytesVariable Size 159387436 bytesDatabase Buffers 440401920 bytesRedo Buffers 7163904 bytesDatabase mounted.Database opened.
SQL> show parameter nameNAME TYPE VALUE------------------------------------ ----------- ------------------------------db_file_name_convert stringdb_name string ZDJSdb_unique_name string ZDJSglobal_names boolean FALSEinstance_name string ZDJSlock_name_space stringlog_file_name_convert stringservice_names string ZDJS
[oracle@std ~]$ rman target /Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jan 14 14:26:58 2015Copyright (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> }using target database control file instead of recovery catalogallocated channel: c1channel c1: sid=143 devtype=DISKallocated channel: c2channel c2: sid=142 devtype=DISKStarting backup at 14-JAN-15channel c1: starting full datafile backupsetchannel c1: specifying datafile(s) in backupsetinput datafile fno=00001 name=/u02/app/oradata/ZDJS/system01.dbfinput datafile fno=00006 name=/u02/app/oradata/ZDJS/plat01.dbfinput datafile fno=00008 name=/u02/app/oradata/ZDJS/rlsm01.dbfinput datafile fno=00002 name=/u02/app/oradata/ZDJS/undotbs01.dbfinput datafile fno=00004 name=/u02/app/oradata/ZDJS/users01.dbfchannel c1: starting piece 1 at 14-JAN-15channel c2: starting full datafile backupsetchannel c2: specifying datafile(s) in backupsetinput datafile fno=00003 name=/u02/app/oradata/ZDJS/sysaux01.dbfinput datafile fno=00010 name=/u02/app/oradata/ZDJS/qhrlst01.dbfinput datafile fno=00005 name=/u02/app/oradata/ZDJS/example01.dbfinput datafile fno=00007 name=/u02/app/oradata/ZDJS/rlst01.dbfinput datafile fno=00009 name=/u02/app/oradata/ZDJS/rlsc01.dbfchannel c2: starting piece 1 at 14-JAN-15channel c1: finished piece 1 at 14-JAN-15piece handle=/u01/rman_bak/ZDJS_6_868976951.bak tag=TAG20150114T142911 comment=NONEchannel c1: backup set complete, elapsed time: 00:01:07channel c1: starting full datafile backupsetchannel c1: specifying datafile(s) in backupsetincluding current control file in backupsetchannel c1: starting piece 1 at 14-JAN-15channel c1: finished piece 1 at 14-JAN-15piece handle=/u01/rman_bak/ZDJS_8_868977018.bak tag=TAG20150114T142911 comment=NONEchannel c1: backup set complete, elapsed time: 00:00:03channel c1: starting full datafile backupsetchannel c1: specifying datafile(s) in backupsetincluding current SPFILE in backupsetchannel c1: starting piece 1 at 14-JAN-15channel c1: finished piece 1 at 14-JAN-15piece handle=/u01/rman_bak/ZDJS_9_868977021.bak tag=TAG20150114T142911 comment=NONEchannel c1: backup set complete, elapsed time: 00:00:02channel c2: finished piece 1 at 14-JAN-15piece handle=/u01/rman_bak/ZDJS_7_868976952.bak tag=TAG20150114T142911 comment=NONEchannel c2: backup set complete, elapsed time: 00:01:18Finished backup at 14-JAN-15Starting backup at 14-JAN-15current log archivedchannel c1: starting archive log backupsetchannel c1: specifying archive log(s) in backup setinput archive log thread=1 sequence=49 recid=1 stamp=868977033channel c1: starting piece 1 at 14-JAN-15channel c1: finished piece 1 at 14-JAN-15piece handle=/u01/rman_bak/arch_10.bak tag=TAG20150114T143033 comment=NONEchannel c1: backup set complete, elapsed time: 00:00:03Finished backup at 14-JAN-15Starting backup at 14-JAN-15channel c1: starting full datafile backupsetchannel c1: specifying datafile(s) in backupsetincluding current control file in backupsetchannel c1: starting piece 1 at 14-JAN-15channel c1: finished piece 1 at 14-JAN-15piece handle=/u01/rman_bak/ctl_11.bak tag=TAG20150114T143038 comment=NONEchannel c1: backup set complete, elapsed time: 00:00:02Finished backup at 14-JAN-15released channel: c1released channel: c2
SQL> col file_name for a50SQL> select file_id,file_name,tablespace_name from dba_data_files; FILE_ID FILE_NAME TABLESPACE_NAME---------- -------------------------------------------------- ------------------------------ 4 /u02/app/oradata/ZDJS/users01.dbf USERS 3 /u02/app/oradata/ZDJS/sysaux01.dbf SYSAUX 2 /u02/app/oradata/ZDJS/undotbs01.dbf UNDOTBS1 1 /u02/app/oradata/ZDJS/system01.dbf SYSTEM 5 /u02/app/oradata/ZDJS/example01.dbf EXAMPLE 6 /u02/app/oradata/ZDJS/plat01.dbf PLAT 7 /u02/app/oradata/ZDJS/rlst01.dbf RLST 8 /u02/app/oradata/ZDJS/rlsm01.dbf RLSM 9 /u02/app/oradata/ZDJS/rlsc01.dbf RLSC 10 /u02/app/oradata/ZDJS/qhrlst01.dbf QHRLST10 rows selected.
2.建立pfile文件
SQL> create pfile from spfile;File created.
3.建立克隆库的目录
[oracle@std oradata]$ mkdir -p $ORACLE_BASE/admin/clonedb/{a,b,c,u}dump[oracle@std oradata]$ mkdir -p $ORACLE_BASE/oradata/clonedb/
4.将主库pfile拷贝生成克隆库的pfile,并生成克隆库的口令文件
##红字部分是修改的部分,蓝字部分是需要增加的
[oracle@std dbs]$ cp initZDJS.ora initclonedb.ora[oracle@std dbs]$ vi initclonedb.ora [oracle@std 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=16*.db_name=‘clonedb‘*.dispatchers=‘(PROTOCOL=TCP) (SERVICE=ZDJSXDB)‘*.job_queue_processes=10*.log_archive_dest_1=‘location=/u01/clonedb_arch‘*.open_cursors=300*.pga_aggregate_target=201326592*.processes=150*.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")
示例在同一台机器上RMAN克隆数据库
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。