Search

Join this Blog for direct reference of any post into your inbox. To join just click on "Join this Site" under "Follower" then Login with your Email.*** DECLARATION: I Maintain this Blog for Helping Myself While at Work and Welcome any body Needing Help!!!.*** CAUTION: Using any of the script from this Blog may contain at Own Risk. These scripts May or May not have been Tested.***

Tuesday, 27 March 2012

Alter‎ System in Oracle

The following command archives all redo log file groups that are full but have not been archived.
SQL>Alter system archive log all;
In order to manually archive the online redo logs, the following statement must be executed in mount status:
SQL>Alter database Archivelog Manual;
SQL>Alter system archive log next;
SQL>Alter system archive log sequence 104;
The below command Archive current redo
SQL>Alter system archive log current;
SQL>Alter system archive log current noswitch;
The following command can be used to Start/Stop arch.
SQL>Alter system archive log stop
SQL>Alter system archive log start
Note: However, changing the archiver this way doesn't last when the database is restarted. When the database is started, it consults log_archive_start in the initialization file to determine if arch is started.
SQL>Alter system disconnect session
SQL>Alter system kill session
SQL>Alter system kill session 'session-id,session-serial'
This command kills a session. The session-id and session-serial parameters are found in the v$session view (columns sid and serial#.
SQL>Alter system checkpoint
Performs a checkpoint
SQL>Alter system dump datafile
This command can be used in order to dump one ore more blocks of a datafile. The following command dumps blocks 50 through 55 of file 5. Which file 5 is can be found out with v$datafile
SQL>Alter system dump datafile 5 block min 50 block max 55;
Note: trace files are only readable by the Oracle account. If you want to change this, set the undocumented initialization parameter _trace_files_public to true. Doing so will, however, cause a big security risk.
SQL>Alter system flush buffer_cache
SQL>Alter system flush buffer_cache;
This command is not available prior to 10g. It flushes the buffer cache in the SGA. 9i had an undocumented command to flush the buffer cache:
SQL>Alter session set events = 'immediate trace name flush_cache';
SQL>Alter system flush shared_pool
This command flushed the shared pool.
SQL>Alter system quiesce restricted
SQL>Alter system suspend|resume
SQL>Alter system switch logfile
This command causes a redo log switch. If the database is in archive log mode, but the ARCH process hasn't been started then command might hang, because it waits for the archiving of the 'next' online redo log.
SQL>Alter system register
Forces the registration of database information with the listener.
SQL>Alter system set timed_statistics
Setting timed_statistics=true might be usefule when using tkprof.
SQL>Alter system set sql_trace
Setting sql_trace=true is a prerequisite when using tkprof.
Alter system set eferred
Alter system can be used to change initialization parameters on system level. However, some parameters, when changed with Alter system don't affect sessions that are already opened at the time when the statement is executed, it only affects sessions started later. These parameters must be changed with Alter system set <initialization parameter> DEFERRED, otherwise a ORA-02096: specified initialization parameter is not modifiable with this option error is returned.
These parameters can be identified as they have a DEFERRED in the isses_modifiable column of v$parameter.
SQL>Alter system reset <parameter_name>
Resets a parameter.
SQL>Alter system reset some_param scope=both sid='*';
Changes the parameter's value for the running instance only. As soon as the instance is stopped and started, this change will be lost.
scope=spfile
Alters an initialization parameter in the spfile
scope=both
Alters an initialization parameter in the spfile as well as in the running instance.

0 comments:

Post a Comment