透過alert日誌重建引數檔案

Diy_os發表於2015-05-07
當spfile損壞,而且沒有了pfile檔案和init.ora檔案,則我們不得不重建引數檔案:
下面模擬引數檔案損壞,刪除了所有的引數檔案:
SQL> startup nomount;
ORA-01078: failure in processing system parameters
LRM-00109: ???????????????????????? '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl3939.ora'

下面透過alert日誌建立了pfile:
SQL> startup nomount;
ORACLE 例程已經啟動。
Total System Global Area  422670336 bytes
Fixed Size                  1336960 bytes
Variable Size             260049280 bytes
Database Buffers          155189248 bytes
Redo Buffers                6094848 bytes
SQL> create spfile from pfile;

檔案已建立。


摘自alert:
processes                = 150
  memory_target            = 404M
  control_files            = "/u01/app/oracle/oradata/orcl3939/control01.ctl"
  control_files            = "/u01/app/oracle/flash_recovery_area/orcl3939/control02.ctl"
  control_files            = "/u01/app/oracle/oradata/orcl3939/control03.ctl"
  db_block_size            = 8192
  compatible               = "11.2.0.0.0"
  db_recovery_file_dest    = "/u01/app/oracle/flash_recovery_area"
  db_recovery_file_dest_size= 3852M
  undo_tablespace          = "UNDOTBS1"
  remote_login_passwordfile= "EXCLUSIVE"
  db_domain                = "localdomain"
  instance_name            = "ORCL3939"
  service_names            = "a,b,c,d"
  dispatchers              = "(PROTOCOL=TCP) (SERVICE=orcl3939XDB)"
  local_listener           = "(ADDRESS=(PROTOCOL=TCP)(HOST = localhost.localdomain)(PORT = 1521))"
  audit_file_dest          = "/u01/app/oracle/admin/orcl3939/adump"
  audit_trail              = "DB"
  db_name                  = "orcl3939"
  open_cursors             = 300
  diagnostic_dest          = "/u01/app/oracle"
  trace_enabled            = TRUE
所以當引數檔案損壞,或者沒有pfile,init.ora檔案,不用太擔心,alter日誌裡記錄了資料庫啟動建立例項的資訊,可以手工建立spfile,過程很簡單吧!
下面給給大家做個很有意思的實驗,緊緊用db_name建立了例項:
SQL> startup force nomount;
ORACLE 例程已經啟動。
Total System Global Area  150667264 bytes
Fixed Size                  1335080 bytes
Variable Size              92274904 bytes
Database Buffers           50331648 bytes
Redo Buffers                6725632 bytes
下面摘自alert日誌:
Starting up:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options.
Using parameter settings in server-side pfile /u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl3939.ora
System parameters with non-default values:
  db_name                  = "orcl3939"
Thu May 07 22:13:34 2015
PMON started with pid=2, OS id=5411 
Thu May 07 22:13:34 2015
VKTM started with pid=3, OS id=5413 at elevated priority
VKTM running at (10)millisec precision with DBRM quantum (100)ms
Thu May 07 22:13:34 2015
GEN0 started with pid=4, OS id=5417 
Thu May 07 22:13:34 2015
DIAG started with pid=5, OS id=5419 
Thu May 07 22:13:34 2015
DBRM started with pid=6, OS id=5421 
Thu May 07 22:13:34 2015
PSP0 started with pid=7, OS id=5423 
Thu May 07 22:13:34 2015
DIA0 started with pid=8, OS id=5425 
......
......
所以我們由上知,在引數檔案中,需要最少的引數就是db_name,資料庫例項就可以啟動了
雖然啟動了例項,但是缺少一些引數,沒有指定控制檔案位置,所以mount狀態出現了錯誤:
SQL> alter database mount;
alter database mount
*
第 1 行出現錯誤:
ORA-00205: ?????????, ??????, ???????



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29876893/viewspace-1628893/,如需轉載,請註明出處,否則將追究法律責任。

相關文章