Oracle数据库:从alert log恢复spfile

今天做实验,改了几个系统参数,结果数据库无法启动,报错:

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/opt/oracle/product/19c/dbhome_1/dbs/initORCLCDB.ora'

$ORACLE_HOME/dbs目录下找不到spfile,也找不到pfile。
但controlfile还在:

$ ls -l $ORACLE_BASE/oradata/ORCLCDB/*.ctl
-rw-r-----. 1 oracle oinstall 18759680 Feb 20 17:40 /opt/oracle/oradata/ORCLCDB/control01.ctl
-rw-r-----. 1 oracle oinstall 18759680 Feb 20 17:40 /opt/oracle/oradata/ORCLCDB/control02.ctl

controlfile在就比较好。因为数据文件的位置都在这里。

关于恢复的思路,参考了这篇文章:How to Recover From Lost or Missing Database Parameter Files (PFILE or SPFILE

选择从alert log恢复spfile。alert log位置在$ORACLE_BASE/diag/rdbms/<sid>/<sid>/trace

$ cat /opt/oracle/diag/rdbms/orclcdb/ORCLCDB/trace/alert_ORCLCDB.log
...
  processes                = 300
  sga_max_size             = 2000M
  nls_language             = "AMERICAN"
  nls_territory            = "AMERICA"
  filesystemio_options     = "setall"
  resource_manager_plan    = "low_prio_apps"
  _exadata_feature_on      = TRUE
  sga_target               = 1500M
  control_files            = "/opt/oracle/oradata/ORCLCDB/control01.ctl"
  control_files            = "/opt/oracle/oradata/ORCLCDB/control02.ctl"
  db_block_size            = 8192
  compatible               = "19.0.0"
  db_create_file_dest      = "/opt/oracle/oradata"
  undo_tablespace          = "UNDOTBS1"
  heat_map                 = "OFF"
  inmemory_size            = 700M
  inmemory_automatic_level = "OFF"
  remote_login_passwordfile= "EXCLUSIVE"
  audit_sys_operations     = FALSE
  dispatchers              = "(PROTOCOL=TCP) (SERVICE=ORCLCDBXDB)"
  local_listener           = "LISTENER_ORCLCDB"
  audit_file_dest          = "/opt/oracle/admin/ORCLCDB/adump"
  commit_wait              = "nowait"
  commit_logging           = "batch"
  audit_trail              = "NONE"
  db_name                  = "ORCLCDB"
  open_cursors             = 300
  pga_aggregate_target     = 384M
  diagnostic_dest          = "/opt/oracle"
  enable_pluggable_database= TRUE
...

将以上部分存为文件/tmp/pfile。
然后:

$ sqlplus / as sysdba
SQL> create spfile from pfile='/tmp/pfile'
SQL> startup

或者:

$ sqlplus / as sysdba
SQL> startup pfile='/tmp/pfile'
SQL> create spfile from memory
Oracle数据库:从alert log恢复spfileOracle数据库:从alert log恢复spfile dingdingfish 博客专家 发布了400 篇原创文章 · 获赞 46 · 访问量 56万+ 他的留言板 关注
上一篇:Duplicate复制数据库并创建物理StandBy(spfile+不同实例名+不同路径)


下一篇:Android-6年开发面经,历时两个月斩获BAT+头条四个公司-Offer