大家都知道,spfile是oracle使用的二进制文件,pfile是可编辑文件。并且我们可以通过create pfile/spfile from spile/pfile来进行相互转换。但是大家知道这个相互转换的功能是sqlplus提供的吗?意思是什么呢,就是说我们可以在oracle shutdown的条件下执行创建语句。我以前每次执行这条语句的时候,都首先把oracle启动起来,现在想想,真是笨死了。O(∩_∩)O哈哈~。
下面通过实验,来验证几个参数文件使用中的方式。
简单的诸如startup pfile='xxxxx'就不说了,我们来说一些有意思的事。
先来看看全貌
SYS@_connect_identifier>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@_connect_identifier>create pfile from spfile='spfileorcl.ora';
pfile的内容如下。
orcl.__db_cache_size=92274688
orcl.__java_pool_size=4194304
orcl.__large_pool_size=209715200
orcl.__oracle_base='/home/oracle/app/oracle'#ORACLE_BASE set from environment
orcl.__pga_aggregate_target=4194304
orcl.__sga_target=478150656
orcl.__shared_io_pool_size=0
orcl.__shared_pool_size=159383552
orcl.__streams_pool_size=0
*.audit_file_dest='/home/oracle/app/oracle/admin/orcl/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/home/oracle/app/oracle/oradata/orcl/control01.ctl','/home/oracle/app/oracle/fast_recovery_area/orcl/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='orcl'
*.db_recovery_file_dest='/home/oracle/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4385144832
*.diagnostic_dest='/home/oracle/app/oracle'
*.dispatchers='(PROTOCOL=TCP)(SERVICE=orclXDB)(DISPATCHERS=3)'
*.fast_start_mttr_target=0
*.local_listener=''
*.log_archive_dest_1='location=/home/oracle/app/oracle/product/11.2.0/dbhome_1/log/archive'
*.log_archive_start=FALSE
*.log_checkpoints_to_alert=FALSE
*.memory_target=481296384
*.open_cursors=300
*.processes=500
*.remote_login_passwordfile='EXCLUSIVE'
*.remote_os_authent=TRUE
*.resumable_timeout=2
*.shared_servers=3
*.undo_tablespace='UNDOTBS1'
SYS@_connect_identifier>show parameter db_unique_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name stringorcl
编辑pfile文件,加上*.db_unique_name='orcluni'
以pfile创建spfileorcl0621.ora
SYS@_connect_identifier>create spfile='spfileorcl0621.ora' from pfile;
然后移除spfile文件
[oracle@localhost dbs]$ ls spfileorcl*
spfileorcl0621.ora spfileorcl.ora.old
编辑pfile,使之指向spfileorcl0621.ora
[oracle@localhost dbs]$ cat <<EOF > initorcl.ora
> SPFILE='/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/spfileorcl0621.ora'
> EOF
[oracle@localhost dbs]$ more initorcl.ora
SPFILE='/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/spfileorcl0621.ora'
[oracle@localhost dbs]$
SYS@_connect_identifier>startup
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.
Total System Global Area 480182272 bytes
Fixed Size 2254424 bytes
Variable Size 369101224 bytes
Database Buffers 100663296 bytes
Redo Buffers 8163328 bytes
Database mounted.
Database opened.
SYS@_connect_identifier>show parameter pfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string/home/oracle/app/oracle/produc
t/11.2.0/dbhome_1/dbs/spfileor
cl0621.ora
SYS@_connect_identifier>
SYS@_connect_identifier>show parameter unique
NAME TYPE VALUE
------------------------------------ -----------