Tuesday, June 26, 2012

Flashback primary database in a dataguard environment

Following steps have been tested in Oracle 10.2

1, On primary database, Stop dataguard broker.
>alter system set dg_broker_start = false;

2, Flashback database to SCN
>shutdown immediate;
>startup mount;
>flashback database to SCN ;
>alter database open resetlog;
>alter system set dg_broker_start = true;


3, Determine the SCN before the RESETLOGS operation occurred.
> SELECT TO_CHAR(RESETLOGS_CHANGE# - 2) FROM V$DATABASE; --should be same as 

4, Obtain the current SCN on the standby database.
>SELECT TO_CHAR(CURRENT_SCN) FROM V$DATABASE;


5, Determine if it is necessary to flash back the standby database.

If the value of CURRENT_SCN is larger than the value of resetlogs_change# - 2(), issue the following statement to flash back the standby database.
>FLASHBACK STANDBY DATABASE TO SCN resetlogs_change# -2;

•If the value of CURRENT_SCN is less than the value of the resetlogs_change# - 2, skip to Step 6.


6, Restart Redo Apply.

>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;

Thursday, May 24, 2012

Remove listener in RAC environment

in 11g
SRVCTL remove listener ...
in 10g
There is no srvctl remove listener command in 10g
Using Netca to remove listener.

Sunday, April 8, 2012

Understand Oracle Table Lock (TM)

 
Summary of Table Locks
SQL Statement Table Lock Mode RS RX S SRX X
SELECT...FROM table... none Y Y Y Y Y
INSERT INTO table ... RX Y Y N N N
UPDATE table ... RX Y* Y* N N N
DELETE FROM table ... RX Y* Y* N N N
SELECT ... FROM table FOR UPDATE OF ... RX Y* Y* N N N
LOCK TABLE table IN ROW SHARE MODE RS Y Y Y Y N
LOCK TABLE table IN ROW EXCLUSIVE MODE RX Y Y N N N
LOCK TABLE table IN SHARE MODE S Y N Y N N
LOCK TABLE table IN SHARE ROW EXCLUSIVE MODE SRX Y N N N N
LOCK TABLE table IN EXCLUSIVE MODE X N N N N N
RS: row share
RX: row exclusive
S: share
SRX: share row exclusive
X: exclusive

Sunday, February 6, 2011

Unable to delete files: Argument list too long

  $ rm -rf *.trc
-ksh: rm: /bin/rm: cannot execute [Argument list too long]

Following command will work
$ find . -name "*.trc" |xargs rm

Delete files old than 30 Days

 find . -mtime +30 -print | xargs rm

Saturday, February 5, 2011

Allow source server ssh/scp access without a password prompt to target server

If you need to add a host to ~oracle/.ssh/authorized_keys, all you need to do is append the source host's public key to the "authorized_keys" file of the target host, and you're all set.

On Source
scp ~oracle/.ssh/id.???..pub (??? = rsa or dsa, ssh public key) <target>:~oracle/.ssh/<source>.id.???..pub

On Target
cat <source>.id.???..pub >> authorized_keys(chmod 600 authorized_key if it is not)

If the source host doesn't have a public key, then run the following command to generate one:
ssh-keygen -t rsa or ssh-keygen -t dsa (press enter for all prompts. either key type will work).

If a ssh/scp has never been done from the source host to the target host, you will need to run a one time "ssh" command manually, so that the source known_hosts file can be updated with the target hosts name, since this isn't done automatically


Tuesday, February 1, 2011

11gR2 RAC BACKUP FAILS WITH "ORA-00245: CONTROL FILE BACKUP OPERATION FAILED"

In 11gR2 onwards, the controlfile backup happens without holding the control file enqueue. For non-RAC database, this doesn't change anything. But, for RAC database, the snapshot controlfile location must be in a shared file system that will be accessible from all the nodes. The snapshot controlfile MUST be accessible by all nodes of a RAC database.

Solution:

The snapshot controlfile MUST be accessible by all nodes of a RAC database, if the snapshot controlfile does not reside in on a shared device this error will raise.
1. Check the snapshot controlfile location:
rman>show all;
2. Configure the snapshot controlfile to a shared disk:
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '<shared_disk>/snapcf_UNSID1.f'; # default

Reference [ID 1268725.1]