Thursday, October 22, 2009

ADMINISTER CRS (Cluster Ready Services)

Start/Stop CRS
crsctl start crs
crsctl stop crs

Check CRS's status
crsctl check crs

See the status of the various services
crs_stat –t

Start/stop nodeapps
srvctl start nodeapps -n
srvctl stop nodeapps -n

Start/stop asm
srvctl start asm -n
srvctl stop asm -n

Start/stop a database (all nodes)
srvctl start database -d
srvctl stop database -d
Start/stop an individual instance
srvctl start instance -d -i
srvctl stop instance -d -i
Check the VIP config
srvctl config nodeapps -n -a -g -s
Change the VIP address, subnetmask or interface
srvctl stop nodeapps -n
srvctl stop nodeapps -n
srvctl modify nodeapps -n -A //
srvctl modify nodeapps -n -A //
srvctl start nodeapps -n
srvctl start nodeapps -n

Locate the voting disk
crsctl query css votedisk

Retrive OCR (Oracle Cluster Registry) information
ocrcheck
To prevent a database starting at boot time
srvctl disable database -d
Change the private interconnect subnet
First find the interface which is in use as the interconnect - run as root from the crs home:
oifcfg getif
Make a note of the interface name (eth1 in the following example), then
run the following:
oifcfg delif -global eth1
oifcfg setif -global eth1/:cluster_interconnect

Friday, October 16, 2009

Setting Oracle Database to Archivelog / Noarchivelog

Setting ORACLE DB into noarchivelog / archivelog mode

NOTE: To change log_mode the database must be in Exclusive mount state


1. Login to sqlplus
-sqlplus /nolog
-connect / as sysdba
2. The db must be mounted EXCLUSIVE and not open for operation
-startup mount;
3. Check the log mode status of the database
-select log_mode from v$database;
4. Setting it to noarchivelog mode
-alter database noarchivelog;
5. Setting db open for user operation
-alter database open;
6. Reverting back to archivelog mode
-alter database archivelog;

Thursday, October 1, 2009

Oracle - Quick Invalid Objects compile

The Oracle database will invalidate objects if a dependent object is changed. If one rebuild a table, the indexes on that table will become invalid because they use the table's rowids and rebuilding the table changes a row's rowid. It is the same with objects like packages, procedures and functions.

In a development environment with lots of users working on the same objects this can become aggravating. Just remember that someone caused the database to invalidate the object. You can control this by controlling who changes objects in the database, or splitting the development into multiple schemas so that one section does not cause another's objects to become invalid.

You can invoke the utl_recomp package to recompile invalid objects:

EXEC UTL_RECOMP.recomp_serial('schema name');

Here is a script to recompile invalid PL/SQL packages and package bodies. You may need to run it more than once for dependencies, if you get errors from the script.
invalid.sql

Set heading off;
set feedback off;
set echo off;
Set lines 999;

Spool run_invalid.sql

select
'ALTER ' || OBJECT_TYPE || ' ' ||
OWNER || '.' || OBJECT_NAME || ' COMPILE;'
from
dba_objects
where
status = 'INVALID'
;

spool off;

set heading on;
set feedback on;
set echo on;

@run_invalid.sql