Oracle基于用戶管理的備份與恢復(fù)之歸檔日志和參數(shù)文件
繼上次介紹了:Oracle數(shù)據(jù)庫基于用戶管理的備份與恢復(fù)之恢復(fù)重做日志之后,我們今天接著介紹基于用戶管理的備份與恢復(fù)之其他文件的備份,包括歸檔日志的備份以及參數(shù)文件的備份與恢復(fù)等。接下來就讓我們來一起了解一下這一過程吧。
備份歸檔日志
--查看***個(gè)歸檔位置過去一天以來生成的歸檔日志,dest_id代表歸檔日志存放位置,對應(yīng)到v$archive_dest中1~10的destination字段值,0代表不可用。
- SQL> select name from v$archived_log where dest_id=1 and first_time>=sysdate-1;
- NAME
- ------------------------------------------------------------------------------------------------------------------------
- /oracle/10g/oracle/log/archive_log/archive_1_23_757801926.arclog
- /oracle/10g/oracle/log/archive_log/archive_1_24_757801926.arclog
- SQL> select name from v$archived_log where dest_id=10 and first_time>=sysdate-1;
- NAME
- ------------------------------------------------------------------------------------------------------------------------
- /oracle/10g/oracle/product/10.2.0/db_1/flash_recovery_area/ORALIFE/archivelog/2011_08_01/o1_mf_1_23_73fljh3f_.arc
- /oracle/10g/oracle/product/10.2.0/db_1/flash_recovery_area/ORALIFE/archivelog/2011_08_02/o1_mf_1_24_73hwlry6_.arc
- SQL> select destination from v$archive_dest;
- DESTINATION
- ------------------------------------------------------------------------------------------------------------------------
- /oracle/10g/oracle/log/archive_log
- /oracle/10g/oracle/log/archive_log2
- USE_DB_RECOVERY_FILE_DEST
- 10 rows selected.
備份參數(shù)文件
1)如果使用文本參數(shù)文件(pfile),使用OS命令拷貝到備份目錄。
2)如果使用spfile,使用create pfile 進(jìn)行備份。
3)如果使用pfile,使用create spfile進(jìn)行備份。
- SQL> show parameter spfile
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- spfile string /oracle/10g/oracle/product/10.
- 2.0/db_1/dbs/spfileoralife.ora
創(chuàng)建pfile,相當(dāng)于備份spfile為pfile
- SQL> create pfile = '/oracle/10g/oracle/bakup/database/pfileoralife.ora'
- 2 from spfile;
- File created.
- SQL> shutdown immediate
- Database closed.
- Database dismounted.
- ORACLE instance shut down.
使用pfile啟動(dòng)數(shù)據(jù)庫到nomount狀態(tài),也可以直接startup pfile='pfile全路徑名'
- SQL> startup nomount pfile='/oracle/10g/oracle/bakup/database/pfileoralife.ora';
- ORACLE instance started.
- Total System Global Area 528482304 bytes
- Fixed Size 1220360 bytes
- Variable Size 146800888 bytes
- Database Buffers 373293056 bytes
- Redo Buffers 7168000 bytes
- SQL> show parameter pfile;--當(dāng)用pfile啟動(dòng)數(shù)據(jù)庫時(shí),spfile參數(shù)為空
- NAME TYPE VALUE
- ------------------------------------ ---------------------- ------------------------------
- spfile string
- SQL> show parameter spfile;
- NAME TYPE VALUE
- ------------------------------------ ---------------------- ------------------------------
- spfile string
- SQL> alter database mount;
- Database altered.
- SQL> alter database open;
- Database altered.
- SQL> shutdown immediate
- Database closed.
- Database dismounted.
- ORACLE instance shut down.
創(chuàng)建spfile到指定位置
- SQL> create spfile='/oracle/10g/oracle/product/10.2.0/db_1/dbs/spfileoralife_test.ora' from
- 2 pfile='/oracle/10g/oracle/bakup/database/pfileoralife.ora';
- File created.
- SQL> shutdown immediate
- ORA-01507: database not mounted
- ORACLE instance shut down.
數(shù)據(jù)庫啟動(dòng)時(shí)不能指定spfile文件位置,但可以在pfile文件中引用spfile
- SQL> startup nomount spfile='/oracle/10g/oracle/product/10.2.0/db_1/dbs/spfileoralife_test.ora'
- SP2-0714: invalid combination of STARTUP options
- SQL> startup spfile='/oracle/10g/oracle/product/10.2.0/db_1/dbs/spfileoralife_test.ora'
- SP2-0714: invalid combination of STARTUP options
在pfileoralife.ora中添加:*.spfile='/oracle/10g/oracle/product/10.2.0/db_1/dbs/spfileoralife_test.ora'使用pfile啟動(dòng)數(shù)據(jù)庫:
- SQL> startup nomount pfile='/oracle/10g/oracle/bakup/database/pfileoralife.ora';
- ORACLE instance started.
- Total System Global Area 528482304 bytes
- Fixed Size 1220360 bytes
- Variable Size 146800888 bytes
- Database Buffers 373293056 bytes
- Redo Buffers 7168000 bytes
- SQL> show parameter spfile;
- NAME TYPE VALUE
- ------------------------------------ ---------------------- ------------------------------
- spfile string /oracle/10g/oracle/product/10.
- 2.0/db_1/dbs/spfileoralife_tes
- t.ora
可以看出,已經(jīng)使用了spfileoralife_test.ora。
關(guān)于Oracle數(shù)據(jù)庫基于用戶管理的備份歸檔日志和參數(shù)文件的知識(shí)就介紹到這里,如果您感興趣還可以看一下:Oracle數(shù)據(jù)庫基于用戶管理的控制文件的備份與恢復(fù),希望本次的介紹能夠?qū)δ兴斋@!
【編輯推薦】






