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/oraclecd 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
相关推荐
Season45033 分钟前
Redis命令 (generic即通用命令)
数据库·redis·bootstrap
liwulin05061 小时前
【ollama】自定义结构化输出
linux·前端·数据库·ollama
木易士心2 小时前
MyBatis数据源切换全面解析
数据库
新中地GIS开发老师2 小时前
地信职业百科④:GIS开发工程师
前端·数据库·gis·webgis·三维gis开发
云和恩墨2 小时前
从“第二存储”到多智能体协作,云和恩墨充实数据基础设施产品矩阵
数据库
ClouGence2 小时前
SAP HANA 到 Doris 数据迁移:4 种方案对比与迁移教程
数据库·后端·dba
霸道流氓气质2 小时前
ApiPost 中配置自动获取 Token 并调用业务接口完整指南
java·服务器·数据库
我不想名字重复2 小时前
redis缓存和数据库数据保持一致
数据库·redis·缓存
宇宙第一小趴菜2 小时前
三、Oracle 核心原理
数据库·oracle
raindayinrain3 小时前
mysql原理--补充
数据库·mysql