第一步:连上数据库,查看spfile文件所在路径
[Oracle@ora11g ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Aug 2 11:37:08 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SYS@cams>startup;
ORACLE instance started.
Total System Global Area 776646656 bytes
Fixed Size 2257272 bytes
Variable Size 478154376 bytes
Database Buffers 289406976 bytes
Redo Buffers 6828032 bytes
Database mounted.
Database opened.
SYS@cams>show parameter pfile;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /u01/app/oracle/product/11.2.0
/db_1/dbs/spfilecams.ora
第二步:查看参数文件路径下文件信息
[oracle@ora11g ~]$ cd $ORACLE_HOME/dbs
[oracle@ora11g dbs]$ ls
hc_cams.dat init.ora lkCAMS orapwcams spfilecams.ora
第三步:为了便于测试,这里创建一个pfile文件
SYS@cams>create pfile from spfile;
File created.
查看新创建的pfile文件
[oracle@ora11g dbs]$ ls
hc_cams.dat initcams.ora init.ora lkCAMS orapwcams spfilecams.ora
查看每个参数文件的内容
[oracle@ora11g dbs]$ strings spfilecams.ora
cams.__db_cache_size=348127232
cams.__java_pool_size=4194304
cams.__large_pool_size=12582912
cams.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
cams.__pga_aggregate_target=272629760
cams.__sga_target=507510784
cams.__shared_io_pool_size=0
cams.__shared_pool_size=130023424
cams.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/cams/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/u01/app/oracle/oradata/cams/control01.ctl','/u01/app/
oracle/fast_recovery_area/cams/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='cams'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4385144832
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=camsXDB)'
*.job_queue_processes=1000
*.memory_target=780140544
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
[oracle@ora11g dbs]$ cat init.ora
#
# $Header: rdbms/admin/init.ora /main/23 2009/05/15 13:35:38 ysarig Exp $
#
# Copyright (c) 1991, 1997, 1998 by Oracle Corporation
# NAME
# init.ora
# FUNCTION
# NOTES
# MODIFIED
# ysarig 05/14/09 - Updating compatible to 11.2
# ysarig 08/13/07 - Fixing the sample for 11g
# atsukerm 08/06/98 - fix for 8.1.
# hpiao 06/05/97 - fix for 803
# glavash 05/12/97 - add oracle_trace_enable comment
# hpiao 04/22/97 - remove ifile=, events=, etc.
# alingelb 09/19/94 - remove vms-specific stuff
# dpawson 07/07/93 - add more comments regarded archive start
# maporter 10/29/92 - Add vms_sga_use_gblpagfile=TRUE
# jloaiza 03/07/92 - change ALPHA to BETA
# danderso 02/26/92 - change db_block_cache_protect to _db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation to help you start by providing
# a starting point to customize your RDBMS installation for your site.
#
# NOTE: The values that are used in this file are only intended to be used
# as a starting point. You may want to adjust/tune those values to your
# specific hardware and needs. You may also consider using Database
# Configuration Assistant tool (DBCA) to create INIT file and to size your
# initial set of tablespaces based on the user input.
###############################################################################
# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)
db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='<ORACLE_BASE>/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='<ORACLE_BASE>/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='<ORACLE_BASE>'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='11.2.0'
[oracle@ora11g dbs]$ cat initcams.ora
cams.__db_cache_size=348127232
cams.__java_pool_size=4194304
cams.__large_pool_size=12582912
cams.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
cams.__pga_aggregate_target=272629760
cams.__sga_target=507510784
cams.__shared_io_pool_size=0
cams.__shared_pool_size=130023424
cams.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/cams/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/u01/app/oracle/oradata/cams/control01.ctl','/u01/app/oracle/fast_recovery_area/cams/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='cams'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4385144832
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=camsXDB)'
*.job_queue_processes=1000
*.memory_target=780140544
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
第四步:模拟参数文件被误删除
[oracle@ora11g dbs]$ mkdir backup
[oracle@ora11g dbs]$ mv initcams.ora init.ora spfilecams.ora backup/
[oracle@ora11g dbs]$ ls
backup hc_cams.dat lkCAMS orapwcams
[oracle@ora11g dbs]$ ls backup/
initcams.ora init.ora spfilecams.ora
第五步:检查数据库是否还能正常工作
SYS@cams>select name,open_mode from v$database;
NAME OPEN_MODE
--------- --------------------
CAMS READ WRITE
显然,现在数据库是可以正常工作的,因为数据库启动过程中已经将spfile参数文件的信息读到内存中。
第六步:这里模拟在数据库运行时,及时发现参数文件被误删除,进行恢复。
这里需要用到Oracle11gR2的新特性,对于Oracle官方文档的路径为: