Documente Academic
Documente Profesional
Documente Cultură
ORA
Introduction
Oracle9i allows more and more parameters to be changed on-the-fly without having to
restart the database. Consequently, the DBA has to remember, more and more often, to
change the parameter file accordingly before the next restart of the database. Oracle9i
enables dynamically altered parameters to be simultaneously written to the parameter file
using server parameter files (SPFILE) so that changes are consistent with ALTER SYSTEM.
SPFILEs are small binary files that cannot be edited. Editing SPFILEs corrupts the file and
either the instance fails to start or an active instance may crash.
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^G^@^@^@^@^B...
@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
*.db_block_size=8192
*.db_domain='ttc.trivadis.com'
*.db_file_multiblock_read_count=16
*.db_files=1022
*.db_name='TVD901A'
...
*. means: all instances of this database system. This is also valid syntax in conventional
INIT.ORA files. This is particularly interesting for Real Application Cluster (RAC) – see
below for more information.
To facilitate this, the best option is to create a conventional INIT.ORA with default name:
init${ORACLE_SID}.ora
This file only contains the path of the SPFILE:
SPFILE = c:\oracle\admin\db1\pfile\spfileDB1.ora
Create SPFILE
A SPFILE is initially created from a conventional text initialization parameters file (PFILE,
INIT.ORA). This can be carried out without a started instance. SYSDBA or SYSOPER
privileges are required to create the SPFILE.
If SPFILE is available at the default location, STARTUP uses this SPFILE if no PFILE is
specified.
Creating an SPFILE from a PFILE at the default location:
SQL> CREATE SPFILE
2 FROM PFILE='/u00/app/oracle/admin/TVD901A/pfile/initTVD901A.ora';
File created.
SQL>
The best solution is to create a (conventional) INIT.ORA with default name in the default
location, which contains only the path to the SPFILE (see above).
Backing up an SPFILE
It is definitely a good idea to always keep a PFILE as a backup of an SPFILE so that a new
SPFILE can be created from the PFILE in the “worst case scenario”. The creation of a PFILE
backup copy from an SPFILE can be automated in the nightly backup job or in a STARTUP
trigger, for example:
The prerequisite is that an SPFILE was used at instance STARTUP, either directly or by an
INIT.ORA which contains the SPFILE=spfile${ORACLE_SID}.ora parameter.
When using SPFILEs, the ALTER SYSTEM command can be used to consistently change
parameters in the SPFILE (which was used at startup), if desired.
SPFILE
Only the SCOPE=SPFILE can be used for static parameters. The change becomes effective
at the next STARTUP:
SQL> CONNECT / AS SYSDBA
Connected.
SQL> ALTER SYSTEM SET db_block_buffers = 20000 SCOPE=SPFILE;
System altered.
SQL>
Comments can be specified for changes, which can then be viewed both in the SPFILE and
in the attribute UPDATE_COMMENT of V$PARAMETER and V$SPPARAMETER.
SQL> ALTER SYSTEM SET timed_statistics=TRUE
2 COMMENT='DB-Review by Trivadis' SCOPE=BOTH;
System altered.
SQL>
2. Export method
The V$PARAMETER view displays whether an SPFILE was used at STARTUP, and if so,
which one:
SQL> select name, value from v$parameter where name='spfile'
NAME VALUE
--------------- ----------------------------------------
spfile C:\oracle\admin\db9\pfile\spfiledb9.ora
SQL>
The SPFILE parameter is displayed in the alert${ORACLE_SID}.log file if the instance was
started with an init${ORACLE_SID}.ora file, which refers to an SPFILE. If the SPFILE
parameter is not displayed in the alert${ORACLE_SID}.log file, either a default SPFILE or
PFILE (conventional INIT.ORA) was used at STARTUP.
Under NT, it must be taken into account that an automatic database start with the
ORA_<sidname>_AUTOSTART=TRUE and ORA_<sidname>_PFILE=<full path to the
PFILE> registry entries corresponds to a STARTUP PFILE=xxx at the command level. The
SPFILE is not used if the database is started automatically. If the database is now started
from the command line and if an SPFILE exists, other parameters may have been included
when starting the database.
This can be avoided by deleting the registry entry or by creating an INIT.ORA which only
contains the PATH to the SPFILE.
Displaying parameters
CREATE PFILE=
OEM Support
An SPFILE can be used for several instances with RAC (Real Application Cluster, formerly
Oracle Parallel Server). The SPFILE is stored on a raw device for this purpose.
Instance-specific parameters are specified with the instance name as prefix:
prod1.instance_name = 'PROD1'
prod2.instance_name = 'PROD2'
*.db_name = 'PROD'
prod1.sort_area_size = 1048576
prod2.sort_area_size = 524288
Conclusion
Consistent changes can now be implemented without vi, Notepad, etc. Furthermore, now
by using an SPFILE within the database, it is possible to establish which parameter file was
used at STARTUP.
SPFILE usage is already supported in OEM. Another positive feature is the option of being
able to use a single SPFILE for RAC.
The only danger with the SPFILE is the possibility of confusing which file was used at
database STARTUP.
It would be desirable for the DBA to have a trigger that would go off at ALTER SYSTEM so
that a history of the changes to the system could be tracked.
If you would like to know more about the new features of Oracle9i, we would be happy to
welcome you to one of our Oracle9i courses (NF9i, AI9-A and AI9-B).
Petra Knöbl