数据库克隆(克隆的主机只需要安装软件不需要安装实例)

主库为99的odsv实例,克隆的为26的odsv实例(克隆的名字可以和主库一样也可以不一样)

create pfile='/tmp/zsh.ora' from spfile;

*.aq_tm_processes=0
*.audit_file_dest='/oracle/admin/odsv/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/oracle/oradata/odsv/control01.ctl','/oracle/oradata/odsv/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='odsv'
*.diagnostic_dest='/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=odsvXDB)'
*.enable_goldengate_replication=TRUE
*.job_queue_processes=0
*.open_cursors=300
*.pga_aggregate_target=4294967296
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=335
*.sga_target=17179869184
*.undo_retention=28800
*.undo_tablespace='UNDOTBS'
DB_UNIQUE_NAME=odsv
LOG_ARCHIVE_DEST_1='location=/data/arch'
STANDBY_FILE_MANAGEMENT=AUTO
db_file_name_convert='/oracle/oradata/odsv','/data/odsv'
log_file_name_convert='/oracle/oradata/odsv','/data/odsv' 






#在克隆的主机上添加listener参数
vi listener.ora 
SID_LIST_LISTENER =
  (SID_LIST =
   (SID_DESC =
    (GLOBAL_DBNAME = odsv)
    (ORACLE_HOME = /oracle/product/11.2.0.4/db_1)
    (SID_NAME = odsv)
   )
  ) 
 #主库和克隆库都需要添加tnsnames参数 
ODSV99 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.8.6.99 )(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = odsv)
    )
  )
ODSV26 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.18.28.26 )(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = odsv)
    )
  )

#创建密码文件
orapwd file=orapwodsv password=sys的密码 force=y
#把主库的密码文件传送到备库的dbs目录中(dbs为$ORACLE_HOME下的目录)


#主库开启归档
#要开启归档模式
#查看归档
archive log list;
--启用归档模式(数据库在mount状态才能开启归档模式)
alter database archivelog;	--关闭归档的noarchivelog
--开启数据库至open
alter database open;

#创建一个screen进程(这个进程即使远程断开也会继续执行命令,没有这个进程yum安装)在screen进程中执行克隆命令
新建\:screen -S lkl -L
script /dev/null            #Cannot open your terminal '/dev/pts/1' - please check.  报错解决方案
查看screen:screen -ls
进入screen: screen -r lkl
暂时退出:  ctrl a+d
关闭:exit

rman target sys/welcome@ODSV99  auxiliary sys/welcome@ODSV26 <<eof
run{
allocate channel prmy5 type disk;
allocate channel prmy6 type disk;
allocate channel prmy7 type disk;
allocate channel prmy8 type disk;
allocate auxiliary channel stb5 type disk;
allocate auxiliary channel stb6 type disk;
allocate auxiliary channel stb7 type disk;
allocate auxiliary channel stb8 type disk;
duplicate target database to odsv from active database;
}
eof

  

 

posted @ 2021-12-22 09:26  zsh~  阅读(98)  评论(0编辑  收藏  举报