SYSTEM表空间是Oracle创建数据库时候自动创建的,每个Oracle数据库都会有SYSTEM表空间,而且SYSTEM表空间总是要保持在联机模式下并且不可重命名,因为其包含了数据库运行所要求的基本信息,如:数据字典、联机求助机制、所有回退段、临时段和自举段、所有的用户数据库实体、其它ORACLE软件产品要求的表等等。

    常用system表空间备份还原方法

    1.系统热备

    1. SQL> alter tablespace system begin backup;
    2. Tablespace altered.
    3. [oracle@instance-ej1hspdt backup]$ cp /opt/oracle/oradata/ORCLCDB/system01.dbf /backup/
    4. SQL> alter tablespace system end backup;
    5. Tablespace altered.
    6. [oracle@instance-ej1hspdt backup]$ rm -rf /opt/oracle/oradata/ORCLCDB/system01.dbf
    7. [oracle@instance-ej1hspdt backup]$ sqlplus / as sysdba
    8. SQL> shutdown abort;
    9. SQL> quit
    10. Disconnected
    11. [oracle@instance-ej1hspdt backup]$ cp /backup/system01.dbf /opt/oracle/oradata/ORCLCDB/
    12. [oracle@instance-ej1hspdt backup]$ sqlplus / as sysdba
    13. SQL> startup mount;
    14. ORACLE instance started.
    15. Total System Global Area 838857584 bytes
    16. Fixed Size 8901488 bytes
    17. Variable Size 700448768 bytes
    18. Database Buffers 121634816 bytes
    19. Redo Buffers 7872512 bytes
    20. Database mounted.
    21. SQL> recovery database;
    22. SP2-0734: unknown command beginning "recovery ..." - rest of line ignored.
    23. SQL> recover database;
    24. Media recovery complete.
    25. SQL> alter database open;
    26. Database altered.

    2.rman备份恢复

    1. RMAN> backup tablespace system;
    2. Starting backup at 28-JUL-19
    3. using channel ORA_DISK_1
    4. channel ORA_DISK_1: starting datafile copy
    5. input datafile file number=00001 name=/opt/oracle/oradata/ORCLCDB/system01.dbf
    6. 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
    7. channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
    8. Finished backup at 28-JUL-19
    9. Starting Control File and SPFILE Autobackup at 28-JUL-19
    10. piece handle=/opt/oracle/product/18c/dbhome_1/dbs/c-2782375137-20190728-00 comment=NONE
    11. Finished Control File and SPFILE Autobackup at 28-JUL-19
    12. [oracle@instance-ej1hspdt backup]$ rm /opt/oracle/oradata/ORCLCDB/system01.dbf
    13. SQL> shutdown abort;
    14. ORACLE instance shut down.
    15. SQL> startup mount;
    16. ORACLE instance started.
    17. Total System Global Area 838857584 bytes
    18. Fixed Size 8901488 bytes
    19. Variable Size 700448768 bytes
    20. Database Buffers 121634816 bytes
    21. Redo Buffers 7872512 bytes
    22. Database mounted.
    23. [oracle@instance-ej1hspdt backup]$ rman target /
    24. Recovery Manager: Release 18.0.0.0.0 - Production on Sun Jul 28 21:00:50 2019
    25. Version 18.3.0.0.0
    26. Copyright (c) 1982, 2018, Oracle and/or its affiliates. All rights reserved.
    27. connected to target database: ORCLCDB (DBID=2782375137, not open)
    28. RMAN> restore tablespace system;
    29. Starting restore at 28-JUL-19
    30. using target database control file instead of recovery catalog
    31. allocated channel: ORA_DISK_1
    32. channel ORA_DISK_1: SID=24 device type=DISK
    33. channel ORA_DISK_1: restoring datafile 00001
    34. 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
    35. destination for restore of datafile 00001: /opt/oracle/oradata/ORCLCDB/system01.dbf
    36. channel ORA_DISK_1: copied datafile copy of datafile 00001, elapsed time: 00:00:15
    37. output file name=/opt/oracle/oradata/ORCLCDB/system01.dbf RECID=0 STAMP=0
    38. Finished restore at 28-JUL-19
    39. RMAN> quit
    40. Recovery Manager complete.
    41. [oracle@instance-ej1hspdt backup]$ sqlplus / as sysdba
    42. SQL*Plus: Release 18.0.0.0.0 - Production on Sun Jul 28 21:01:57 2019
    43. Version 18.3.0.0.0
    44. Copyright (c) 1982, 2018, Oracle. All rights reserved.
    45. Connected to:
    46. Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
    47. Version 18.3.0.0.0
    48. SQL> recover database;
    49. Media recovery complete.
    50. SQL> alter database open;
    51. Database altered.