Oracle RMAN克隆数据库(同主机)

Oracle RMAN克隆数据库(同主机)

介绍

通过使用数据库备份,DBA 可以在同一服务器或其它服务器上建立副本数据库。

这个副本数据库可以和主数据库有相同的名称(拷贝)或与主数据库名称不同(克隆)。

ORACLE 在数据库拷贝和数据库克隆之间唯一不同的是拷贝的数据库不能更改名称

克隆数据库

创建目录

oracle@hfzcdb91:/home/oracle\]$mkdir /oradata/hfzctest \[oracle@hfzcdb91:/home/oracle\]$mkdir -p /oracle/app/oracle/admin/hfzctest/adump #### 创建pfile文件 \[oracle@hfzcdb91:/home/oracle\]$cd $ORACLE_HOME \[oracle@hfzcdb91:/oracle/app/oracle/product/19c/db_1/dbs\]$sqlplus / as sysdba SYS@hfzcdb\> create pfile from spfile; \[oracle@hfzcdb91:/oracle/app/oracle/product/19c/db_1/dbs\]$mv inithfzcdb.ora inithfzctest.ora \[oracle@hfzcdb91:/oracle/app/oracle/product/19c/db_1/dbs\]$vi inithfzctest.ora \[oracle@hfzcdb91:/oracle/app/oracle/product/19c/db_1/dbs\]$cat inithfzctest.ora ```sql *.audit_file_dest='/oracle/app/oracle/admin/hfzctest/adump' #修改 *.audit_trail='db' *.compatible='19.0.0' *.control_files='/oradata/hfzctest/control01.ctl','/oradata/hfzctest/control02.ctl'# 修改 #修改Restore Controlfile *.db_block_size=16384 *.db_name='hfzctest' #修改 *.db_recovery_file_dest_size=107374182400 *.db_recovery_file_dest='/archive' *.diagnostic_dest='/oracle/app/oracle' *.dispatchers='(PROTOCOL=TCP) (SERVICE=hfzctestXDB)' #修改 *.nls_language='AMERICAN' *.nls_territory='AMERICA' *.open_cursors=300 *.pga_aggregate_target=500m *.processes=300 *.remote_login_passwordfile='EXCLUSIVE' *.sga_target=1800m *.undo_tablespace='UNDOTBS1' *.db_file_name_convert=('/oradata/hfzcdb/','/oradata/hfzctest/') #修改 *.log_file_name_convert=('/oradata/hfzcdb/','/oradata/hfzctest/') #修改【转换的路径】 ``` #### 创建密码文件 \[oracle@hfzcdb91:/oracle/app/oracle/product/19c/db_1/dbs\]$cp orapwhfzcdb orapwhfzctest \[oracle@hfzcdb91:/oracle/app/oracle/product/19c/db_1/dbs\]$export ORACLE_SID =hfzctest \[oracle@hfzcdb91:/oracle/app/oracle/product/19c/db_1/dbs\]$sqlplus "/as sysdba" SQL\> startup nomount; --报错 ```sql --ORA-27125: unable to create shared memory segment --Linux-x86_64 Error: 28: No space left on device --Additional information: 4549 --Additional information: 1879048192 ``` \[root@hfzcdb91 \~\]# vi /etc/sysctl.conf ```sql For more details see sysctl(8). [root@hfzcdb91 ~]# sysctl -p fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmmax = 6355443200 #增加一倍 kernel.shmall = 1519200 #增加一倍 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.ipv4.conf.all.rp_filter = 2 net.ipv4.conf.default.rp_filter = 2 net.ipv4.ip_forward = 1 vm.nr_hugepages = 7500 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048586 kernel.panic_on_oops = 1 vm.swappiness = 5 vm.min_free_kbytes = 204800 ``` #### 启动数据库到nomount \[root@hfzcdb91 \~\]# su - oracle Last login: Sun Apr 2 19:00:50 CST 2023 on pts/3 \[oracle@hfzcdb91:/home/oracle\]$export ORACLE_SID=hfzctest \[oracle@hfzcdb91:/home/oracle\]$sqlplus "/as sysdba" SYS@hfzcdb\> create pfile from spfile; SYS@hfzcdb\> exit SQL\> startup nomount #### 修改listener.ora \[oracle@hfzcdb91:/oracle/app/oracle/product/19c/db_1/network/admin/samples\]$vi listener.ora \[oracle@hfzcdb91:/oracle/app/oracle/product/19c/db_1/network/admin\]$vi listener.ora \[oracle@hfzcdb91:/oracle/app/oracle/product/19c/db_1/network/admin\]$vi tnsnames.ora \[oracle@hfzcdb91:/oracle/app/oracle/product/19c/db_1/network/admin\]$lsnrctl reload ```sql [oracle@hfzcdb91:/oracle/app/oracle/product/19c/db_1/network/admin]$cat listener.ora # listener.ora Network Configuration File: /oracle/app/oracle/product/19c/db_1/network/admin/listener.ora # Generated by Oracle configuration tools. LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = hfzcdb91)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) ) SID_LIST_LISTENER= (SID_LIST= (SID_DESC= (GLOBAL_DBNAME= hfzctest) (SID_NAME= hfzctest) (ORACLE_HOME=/oracle/app/oracle/product/19c/db_1) ) ) ``` ```sql [oracle@hfzcdb91:/oracle/app/oracle/product/19c/db_1/network/admin]$cat tnsnames.ora # tnsnames.ora Network Configuration File: /oracle/app/oracle/product/19c/db_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools. HFZCDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = hfzcdb91)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = hfzcdb) ) ) LISTENER_HFZCDB = (ADDRESS = (PROTOCOL = TCP)(HOST = hfzcdb91)(PORT = 1521)) HFZCTEST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = hfzcdb91)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = hfzctest) ) ) ``` #### 使用rman克隆数据 \[oracle@hfzcdb91:/oracle/app/oracle/product/19c/db_1/network/admin\]$rman target sys/oracle@hfzcdb auxiliary sys/oracle@hfzctest 【同时连接两个库】 ```sql RMAN> duplicate database to hfzctest from active database nofilenamecheck; ``` ```sql Recovery Manager: Release 19.0.0.0.0 - Production on Fri Dec 29 16:39:58 2023 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. connected to target database: HFZCDB (DBID=797496974) connected to auxiliary database: HFZCTEST (not mounted) RMAN> duplicate database to hfzctest from active database nofilenamecheck; Starting Duplicate Db at 2023-12-29 16:41:27 using target database control file instead of recovery catalog allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: SID=246 device type=DISK current log archived contents of Memory Script: { sql clone "create spfile from memory"; } executing Memory Script sql statement: create spfile from memory contents of Memory Script: { shutdown clone immediate; startup clone nomount; } executing Memory Script Oracle instance shut down connected to auxiliary database (not started) Oracle instance started Total System Global Area 1895822688 bytes Fixed Size 8897888 bytes Variable Size 436207616 bytes Database Buffers 1442840576 bytes Redo Buffers 7876608 bytes contents of Memory Script: { sql clone "alter system set db_name = ''HFZCDB'' comment= ''Modified by RMAN duplicate'' scope=spfile"; sql clone "alter system set db_unique_name = ''hfzctest'' comment= ''Modified by RMAN duplicate'' scope=spfile"; shutdown clone immediate; startup clone force nomount restore clone from service 'hfzcdb' primary controlfile; alter clone database mount; } executing Memory Script sql statement: alter system set db_name = ''HFZCDB'' comment= ''Modified by RMAN duplica te'' scope=spfile sql statement: alter system set db_unique_name = ''hfzctest'' comment= ''Modified by RMA N duplicate'' scope=spfile Oracle instance shut down Oracle instance started Total System Global Area 1895822688 bytes Fixed Size 8897888 bytes Variable Size 436207616 bytes Database Buffers 1442840576 bytes Redo Buffers 7876608 bytes Starting restore at 2023-12-29 16:42:55 allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: SID=245 device type=DISK channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring control file channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:04 output file name=/oradata/hfzctest/control01.ctl output file name=/oradata/hfzctest/control02.ctl Finished restore at 2023-12-29 16:43:05 database mounted contents of Memory Script: { set newname for datafile 1 to "/oradata/hfzctest/system01.dbf"; set newname for datafile 2 to "/oradata/hfzctest/sysaux01.dbf"; set newname for datafile 3 to "/oradata/hfzctest/undotbs01.dbf"; set newname for datafile 4 to "/oradata/hfzctest/users01.dbf"; set newname for datafile 5 to "/oradata/hfzctest/fgedu01.dbf"; restore from nonsparse from service 'hfzcdb' clone database ; sql 'alter system archive log current'; } executing Memory Script executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME Starting restore at 2023-12-29 16:43:11 using channel ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoring datafile 00001 to /oradata/hfzctest/system01.dbf channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:16 channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoring datafile 00002 to /oradata/hfzctest/sysaux01.dbf channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07 channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoring datafile 00003 to /oradata/hfzctest/undotbs01.dbf channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:04 channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoring datafile 00004 to /oradata/hfzctest/users01.dbf channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoring datafile 00005 to /oradata/hfzctest/fgedu01.dbf channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 Finished restore at 2023-12-29 16:43:42 sql statement: alter system archive log current current log archived contents of Memory Script: { restore clone force from service 'hfzcdb' archivelog from scn 1439945; switch clone datafile all; } executing Memory Script Starting restore at 2023-12-29 16:43:43 using channel ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=9 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=8 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=1 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=2 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=3 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=2 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=3 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=1 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=2 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=3 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=4 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=5 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=1 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=1 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=1 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=2 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=3 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=4 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=5 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=6 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=7 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=8 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=9 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=10 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=11 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=12 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=13 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=3 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=4 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service hfzcdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=5 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 Finished restore at 2023-12-29 16:44:19 datafile 1 switched to datafile copy input datafile copy RECID=6 STAMP=1156869860 file name=/oradata/hfzctest/system01.dbf datafile 2 switched to datafile copy input datafile copy RECID=7 STAMP=1156869860 file name=/oradata/hfzctest/sysaux01.dbf datafile 3 switched to datafile copy input datafile copy RECID=8 STAMP=1156869860 file name=/oradata/hfzctest/undotbs01.dbf datafile 4 switched to datafile copy input datafile copy RECID=9 STAMP=1156869860 file name=/oradata/hfzctest/users01.dbf datafile 5 switched to datafile copy input datafile copy RECID=10 STAMP=1156869860 file name=/oradata/hfzctest/fgedu01.dbf contents of Memory Script: { set until scn 1440086; recover clone database delete archivelog ; } executing Memory Script executing command: SET until clause Starting recover at 2023-12-29 16:44:20 using channel ORA_AUX_DISK_1 starting media recovery archived log for thread 1 with sequence 2 is already on disk as file /archive/HFZCTEST/arc hivelog/2023_12_29/o1_mf_1_2_lrx1p6h3_.arc archived log for thread 1 with sequence 3 is already on disk as file /archive/HFZCTEST/arc hivelog/2023_12_29/o1_mf_1_3_lrx1p7nl_.arc archived log file name=/archive/HFZCTEST/archivelog/2023_12_29/o1_mf_1_2_lrx1p6h3_.arc thr ead=1 sequence=2 archived log file name=/archive/HFZCTEST/archivelog/2023_12_29/o1_mf_1_3_lrx1p7nl_.arc thr ead=1 sequence=3 media recovery complete, elapsed time: 00:00:01 Finished recover at 2023-12-29 16:44:24 contents of Memory Script: { delete clone force archivelog all; } executing Memory Script released channel: ORA_AUX_DISK_1 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=3415 device type=DISK deleted archived log archived log file name=/archive/HFZCTEST/archivelog/2023_12_29/o1_mf_1_1_lrx1p2x2_.arc REC ID=3 STAMP=1156869826 deleted archived log archived log file name=/archive/HFZCTEST/archivelog/2023_12_29/o1_mf_1_2_lrx1p6h3_.arc REC ID=6 STAMP=1156869830 deleted archived log archived log file name=/archive/HFZCTEST/archivelog/2023_12_29/o1_mf_1_3_lrx1p7nl_.arc REC ID=7 STAMP=1156869831 deleted archived log archived log file name=/archive/HFZCTEST/archivelog/2023_12_29/o1_mf_1_1_lrx1p8vq_.arc REC ID=8 STAMP=1156869832 Deleted 4 objects Oracle instance started Total System Global Area 1895822688 bytes Fixed Size 8897888 bytes Variable Size 436207616 bytes Database Buffers 1442840576 bytes Redo Buffers 7876608 bytes contents of Memory Script: { sql clone "alter system set db_name = ''HFZCTEST'' comment= ''Reset to original value by RMAN'' scope=spfile"; sql clone "alter system reset db_unique_name scope=spfile"; } executing Memory Script sql statement: alter system set db_name = ''HFZCTEST'' comment= ''Reset to original valu e by RMAN'' scope=spfile sql statement: alter system reset db_unique_name scope=spfile Oracle instance started Total System Global Area 1895822688 bytes Fixed Size 8897888 bytes Variable Size 436207616 bytes Database Buffers 1442840576 bytes Redo Buffers 7876608 bytes sql statement: CREATE CONTROLFILE REUSE SET DATABASE "HFZCTEST" RESETLOGS ARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 8192 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 ( '/oradata/hfzctest/redo01.log' ) SIZE 200 M REUSE, GROUP 2 ( '/oradata/hfzctest/redo02.log' ) SIZE 200 M REUSE, GROUP 3 ( '/oradata/hfzctest/redo03.log' ) SIZE 200 M REUSE DATAFILE '/oradata/hfzctest/system01.dbf' CHARACTER SET AL32UTF8 contents of Memory Script: { catalog clone datafilecopy "/oradata/hfzctest/sysaux01.dbf", "/oradata/hfzctest/undotbs01.dbf", "/oradata/hfzctest/users01.dbf", "/oradata/hfzctest/fgedu01.dbf"; switch clone datafile all; } executing Memory Script cataloged datafile copy datafile copy file name=/oradata/hfzctest/sysaux01.dbf RECID=1 STAMP=1156869902 cataloged datafile copy datafile copy file name=/oradata/hfzctest/undotbs01.dbf RECID=2 STAMP=1156869902 cataloged datafile copy datafile copy file name=/oradata/hfzctest/users01.dbf RECID=3 STAMP=1156869903 cataloged datafile copy datafile copy file name=/oradata/hfzctest/fgedu01.dbf RECID=4 STAMP=1156869903 datafile 2 switched to datafile copy input datafile copy RECID=1 STAMP=1156869902 file name=/oradata/hfzctest/sysaux01.dbf datafile 3 switched to datafile copy input datafile copy RECID=2 STAMP=1156869902 file name=/oradata/hfzctest/undotbs01.dbf datafile 4 switched to datafile copy input datafile copy RECID=3 STAMP=1156869903 file name=/oradata/hfzctest/users01.dbf datafile 5 switched to datafile copy input datafile copy RECID=4 STAMP=1156869903 file name=/oradata/hfzctest/fgedu01.dbf contents of Memory Script: { Alter clone database open resetlogs; } executing Memory Script database opened Cannot remove created server parameter file Finished Duplicate Db at 2023-12-29 16:45:24 ``` #### 查看数据实例 \[oracle@hfzcdb91:/oracle/app/oracle/product/19c/db_1/network/admin\]$ps -ef \|grep smon \[oracle@hfzcdb91:/oracle/app/oracle/product/19c/db_1/network/admin\]$export ORACLE_SID=hfzctest \[oracle@hfzcdb91:/oracle/app/oracle/product/19c/db_1/network/admin\]$sqlplus / as sysdba ```sql SYS@hfzctest> select status from v$instance; STATUS ------------ OPEN SYS@hfzctest> select name from v$datafile; NAME ---------------------------------------- /oradata/hfzctest/system01.dbf /oradata/hfzctest/sysaux01.dbf /oradata/hfzctest/undotbs01.dbf /oradata/hfzctest/users01.dbf /oradata/hfzctest/hefei01.dbf ```

相关推荐
梦三辰21 分钟前
超详细解读:数据库MVCC机制
数据库·mysql·mvcc·快照
hxung1 小时前
如何保证mysql和redis的数据一致性
java·数据库·redis·mysql
涛思数据(TDengine)1 小时前
时序数据库 TDengine Cloud 私有连接实战指南:4步实现数据安全传输与成本优化
数据库·时序数据库·tdengine
翻滚吧键盘2 小时前
debian12 mysql完全卸载
数据库·mysql
安得权2 小时前
Ubunut18.04 离线安装MySQL 5.7.35
数据库·mysql·adb
镜舟科技2 小时前
什么是模型上下文协议(MCP)?
数据库·api·mcp
Databend2 小时前
理解 Calvin 的架构设计与工作原理
数据库
白鸽(二般)2 小时前
mysql
数据库·mysql
AuLuo-2 小时前
Mysql专题篇章
数据库
Linging_243 小时前
Debezium嵌入式连接postgresql封装服务
数据库·postgresql