SYSTEM表空间是Oracle创建数据库时候自动创建的,每个Oracle数据库都会有SYSTEM表空间,而且SYSTEM表空间总是要保持在联机模式下并且不可重命名,因为其包含了数据库运行所要求的基本信息,如:数据字典、联机求助机制、所有回退段、临时段和自举段、所有的用户数据库实体、其它ORACLE软件产品要求的表等等。
常用system表空间备份还原方法
1.系统热备
SQL> alter tablespace system begin backup;
Tablespace altered.
[oracle@instance-ej1hspdt backup]$ cp /opt/oracle/oradata/ORCLCDB/system01.dbf /backup/
SQL> alter tablespace system end backup;
Tablespace altered.
[oracle@instance-ej1hspdt backup]$ rm -rf /opt/oracle/oradata/ORCLCDB/system01.dbf
[oracle@instance-ej1hspdt backup]$ sqlplus / as sysdba
SQL> shutdown abort;
SQL> quit
Disconnected
[oracle@instance-ej1hspdt backup]$ cp /backup/system01.dbf /opt/oracle/oradata/ORCLCDB/
[oracle@instance-ej1hspdt backup]$ sqlplus / as sysdba
SQL> startup mount;
ORACLE instance started.
Total System Global Area 838857584 bytes
Fixed Size 8901488 bytes
Variable Size 700448768 bytes
Database Buffers 121634816 bytes
Redo Buffers 7872512 bytes
Database mounted.
SQL> recovery database;
SP2-0734: unknown command beginning "recovery ..." - rest of line ignored.
SQL> recover database;
Media recovery complete.
SQL> alter database open;
Database altered.
2.rman备份恢复
RMAN> backup tablespace system;
Starting backup at 28-JUL-19
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/opt/oracle/oradata/ORCLCDB/system01.dbf
output file name=/opt/oracle/product/18c/dbhome_1/dbs/data_D-ORCLCDB_I-2782375137_TS-SYSTEM_FNO-1_3bu7qi0p tag=TAG20190728T205656 RECID=15 STAMP=1014843429
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
Finished backup at 28-JUL-19
Starting Control File and SPFILE Autobackup at 28-JUL-19
piece handle=/opt/oracle/product/18c/dbhome_1/dbs/c-2782375137-20190728-00 comment=NONE
Finished Control File and SPFILE Autobackup at 28-JUL-19
[oracle@instance-ej1hspdt backup]$ rm /opt/oracle/oradata/ORCLCDB/system01.dbf
SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 838857584 bytes
Fixed Size 8901488 bytes
Variable Size 700448768 bytes
Database Buffers 121634816 bytes
Redo Buffers 7872512 bytes
Database mounted.
[oracle@instance-ej1hspdt backup]$ rman target /
Recovery Manager: Release 18.0.0.0.0 - Production on Sun Jul 28 21:00:50 2019
Version 18.3.0.0.0
Copyright (c) 1982, 2018, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCLCDB (DBID=2782375137, not open)
RMAN> restore tablespace system;
Starting restore at 28-JUL-19
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=24 device type=DISK
channel ORA_DISK_1: restoring datafile 00001
input datafile copy RECID=15 STAMP=1014843429 file name=/opt/oracle/product/18c/dbhome_1/dbs/data_D-ORCLCDB_I-2782375137_TS-SYSTEM_FNO-1_3bu7qi0p
destination for restore of datafile 00001: /opt/oracle/oradata/ORCLCDB/system01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00001, elapsed time: 00:00:15
output file name=/opt/oracle/oradata/ORCLCDB/system01.dbf RECID=0 STAMP=0
Finished restore at 28-JUL-19
RMAN> quit
Recovery Manager complete.
[oracle@instance-ej1hspdt backup]$ sqlplus / as sysdba
SQL*Plus: Release 18.0.0.0.0 - Production on Sun Jul 28 21:01:57 2019
Version 18.3.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.
Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0
SQL> recover database;
Media recovery complete.
SQL> alter database open;
Database altered.