ORACLE DBMS

BACKUP & RECOVERY #2 초기 파라미터 백업

Boggi 2024. 8. 23. 20:32
반응형

정상 가동되는 spfile로 백업파일에 pfile 생성 

SYS@ORA19C>CREATE PFILE='/home/oracle/dontouch/initORA19C.ora' FROM spfile;

 

※ spfile 위치 :  $ORACLE_HOME/dbs

[oracle@oracle19c dontouch]$ cd $ORACLE_HOME/dbs

 

● spfile, pfile 손상

[oracle@oracle19c dbs]$ rm spfileORA19C.ora
[oracle@oracle19c dbs]$ ls
hc_ORA19C.dat  init.ora  lkORA19C  orapwORA19C


오류 확인

SYS@ORA19C>startup
ORACLE instance started.

Total System Global Area  838858176 bytes
Fixed Size                  8902080 bytes
Variable Size             578813952 bytes
Database Buffers          243269632 bytes
Redo Buffers                7872512 bytes
ORA-00214: control file '/u01/app/oracle/oradata/ORA19C/control01.ctl' version
11293 inconsistent with file
'/u01/app/oracle/fast_recovery_area/ORA19C/control02.ctl' version 11190

 

불완전 DB종료

SYS@ORA19C>shutdown abort
ORACLE instance shut down.

SYS@ORA19C>exit

 

an idle instance로 접속하게 되네?

[oracle@oracle19c dbs]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Aug 22 01:51:41 2024
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Connected to an idle instance.

 

startup하기(pfile로 startup이 됨)

SYS@ORA19C>startup

SYS@ORA19C>show parameter spfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string

 

백업파일에서 spfile위치에 pfile restore

[oracle@oracle19c dontouch]$ cp -v initORA19C.ora $ORACLE_HOME/dbs
‘initORA19C.ora’ -> ‘/u01/app/oracle/product/19.3.0/dbhome_1/dbs/initORA19C.ora’

 

오라클에서 pfile로 spfile 만들기

SYS@ORA19C>CREATE spfile FROM pfile;

File created.

--초기 파라미터 파일이 깨져서 DB가 생성되지 못해도 pfile은 존재하니까 파일 생성이 가능하구나!

 

startup

SYS@ORA19C>startup
ORACLE instance started.

Total System Global Area  838858176 bytes
Fixed Size                  8902080 bytes
Variable Size             557842432 bytes
Database Buffers          264241152 bytes
Redo Buffers                7872512 bytes
Database mounted.
Database opened.

 

초기 파라미터 확인

SYS@ORA19C>show parameter spfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      /u01/app/oracle/product/19.3.0
                                                 /dbhome_1/dbs/spfileORA19C.ora

 

결론: spfile 깨지면 pfile로 복원(pfile은 꼭 있어야 한다!)