Parameter file of sqlplus

To get the current value of an instance parameter, you can query the view V$parameter or use show parameter

sys@ORCL>select value from v$parameter where name='pga_aggregate_target';

VALUE
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----------------------------------------
0

sys@ORCL>show parameter pga_agg;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
pga_aggregate_target                 big integer 0


 DISTRIBUTED_TRANSACTIONS, which can be set to a positive integer, can control the number of concurrent distributed transactions that the database can execute, but after 9.0.1, this parameter has been removed:

sys@ORCL>alter system set distributed_transactions=10;
alter system set distributed_transactions=10
*
Error on line 1:
ORA-25138: DISTRIBUTED_TRANSACTIONS initialization parameter obsolete

-----------------------------------------------------------------------------------------

Server parameter file SPFILE

1. SPFILE is stored on the database server; it must exist on the server host itself and cannot be placed on the client. For parameter settings, there is only one "source of information"

2. Manual maintenance is not possible. Using the alter system, the value can be directly written into the spfile. The administrator does not need to manually find and maintain all parameter files.


Naming convention spfile%oracle_sid%.ora


Set parameter values ​​in spfile

spfile is a binary file and cannot be edited with a text editor, you must use the alter system command

alter system set parameter=value <comment='text'> <deferred> <scope=memory|spfile|both> <sid='sid|*'>

By default, alter system set updates the currently running instance and modifies the spfile

1. parameter=value provides the parameter and the new value of the parameter

2. comment='text' An optional comment related to this parameter setting, which will appear in the update_comment field of the V$parameter view.

3. deferred specifies whether the system modification takes effect only for subsequent sessions (invalid for the currently established session, including the session that performs this modification).

            By default, the alter system command takes effect immediately, but some parameters cannot be modified "immediately", only for newly established sessions.

sys@ORCL>select name from v$parameter where issys_modifiable='DEFERRED';

NAME
--------------------------------------------------------------------------------

backup_tape_io_slaves
recyclebin
audit_file_dest
object_cache_optimal_size
object_cache_max_size_percent
sort_area_size
sort_area_retained_size
olap_page_pool_size

8 rows have been selected.

As shown above, sort_area_size can be modified at the system level, but must be modified in a deferred fashion

sys@ORCL>alter system set sort_area_size=65536;
alter system set sort_area_size=65536
                                    *
Error on line 1:
ORA-02096: the specified initialization parameter for this option is not modifiable


sys@ORCL>alter system set sort_area_size=65536 deferred;

System has changed.

4. scope=memory|spfile|both indicates the "scope" set by this parameter

scope=memory is only modified in the instance; it will not be saved after the database restarts. The next time the database is restarted, the settings are still the same as before the modification

 scope= spfile     only modifies the value in spfile. This change will not take effect until the database is restarted and the spfile is processed again.

    Some parameters can only be modified using this option, for example, the processes parameter must use  scope=spfile because we cannot modify the processes value of the active instance

scope= both     memory + spfile will complete parameter modification. This modification will be reflected in the current instance, and the modification will also take effect the next time it is restarted. This is the default scope value when using spfile


5. sid='sid|* '     is mainly used in a cluster environment, the default value is  sid='* '. Parameter settings can be uniquely specified for any given instance in the cluster.

                The sid= setting is generally not required unless using oracle RAC


The usage is as follows:

sys@ORCL>alter system set pga_aggregate_target=1024m;
System has changed.

sys@ORCL>alter system set pga_aggregate_target=1024m comment='changed 21-March-2018 of Anna';
System has changed.

sys@ORCL>select value,update_comment from v$parameter where name='pga_aggregate_target';

VALUE
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----------------------------------------
UPDATE_COMMENT
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----------------------------------------
1073741824
changed 21-March-2018 of Anna


Cancel the value setting in spfile

I don't want spfile to have this parameter setting, I want to delete it, but I can't use a text editor to edit this file, the same is done using the alter system command:

alter system reset parameter <scope=memory|spfile|both> sid='sid|*'

The scope and sid settings have the same meaning as before, but the SID= part is required:

sys@ORCL>alter system reset sort_area_size scope=spfile sid='*';
System has changed.

sys@ORCL>create pfile='D:\app\Administrator\product\11.2.0\dbhome_1\database\pf
le.tst' from spfile;

File has been created.
Then check the contents of D:\app\Administrator\product\11.2.0\dbhome_1\database\pfile.tst, which will be generated on the database server. As you can see, there is no longer the sort_area_size parameter in the parameter file.

create pfile from spfile

create pfile... from spfile

Creates a plain text file from the binary spfile, which can be edited in any text editor and can later be used to start the database.

1. Create a "one-off" parameter file for starting the database to complete the maintenance, with some special settings.

You can execute the create pfile... from spfile command and edit the resulting text pfile to modify the desired settings.

Then start the database and use the pfile=<filename> option to specify that this pfile should be used instead of the spfile.

After completion, it can be started normally, and the database will use spfile again

2. Maintain modification history and record modifications in comments

Modify the corrupted spfile

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325984056&siteId=291194637