Archive for December 2008

Audit SYSDBA access to syslog

First of all we will show how to log Oracle’s DB audit information including mandatory audit to a remote syslog host.

SQL> show parameter audit_trail;

NAME                                 TYPE        VALUE
———————————— ———– ——————————
audit_trail                          string      NONE

Need to set this to OS for syslog. On the database server to be audited:

SQL> ALTER SYSTEM SET audit_syslog_level=’AUTH.WARNING’ SCOPE=SPFILE;
System altered.

SQL> SHUTDOWN IMMEDIATE
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup
ORACLE instance started.
Total System Global Area  167772160 bytes
Fixed Size                  1218316 bytes
Variable Size              67111156 bytes
Database Buffers           96468992 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.

From a client machine whose actions will be audited on that server.

C:\Documents and Settings\Paul>sqlplus sys/orcl@orcl as sysdba

From DB Server OS to be audited the audit log just created.

[root@localhost dbs]# tail -l /var/log/messages

Jan 31 00:17:12 localhost Oracle Audit[18540]:
ACTION : ‘CONNECT’ DATABASE USER: ’sys’ PRIVILEGE :
SYSDBA CLIENT USER: Paul CLIENT TERMINAL: LAPTOP STATUS: 0

Regards,

Tom

How to Change the DBID and the DBNAME by using NID

Change Both DBID and DBNAME
===========================

  1. Backup of the database.
  2. Shutdown IMMEDIATE of the database
  3. STARTUP MOUNT
  4. Open one session and run NID with sysdba privileges
     % nid TARGET=SYS/password@test_db DBNAME=test_db2
     - the value of DBNAME is the new dbname of the database
  5. After DBNEWID successfully changes the DBID,Shutdown IMMEDIATE of the database
  6. Set the DB_NAME initialization parameter in the
     initialization parameter file to the new database name.
  7. Create a new password file.
  8. Startup of the database with open resetlogs

more on metalink Note:224266.1

                                                                        Regards,
                                                                             Tom

Restore database on a different node

Hi,

yesterday I cloned our prod database to test. I can’t use duplicate command because prod is on different network than test so I haven’t connection to production RMAN catalog. So I performed standard full restore.

On prod:
——–
1) Connect to the target database using rman and backup the database on node 1

$ rman target /

2) Move the following files to the NODE 2:
- backup pieces
- controlfile backup piece
- the parameter file i.e init.ora file to the default location i.e $ORACLE_HOME/dbs

3) Once the PFILE is suitably modified invoke Rman on the NODE 2 after setting the Oracle environment variables and start the database in nomount mode:
export ORACLE_HOME, ORACLE_SID, PATH

$rman target /

RMAN> startup nomount

4) Restore the controlfile from the backup piece.
restore controlfile from  ‘/node2/database/backup/c-3932056136-20070213-02′;

5) Mount the database
RMAN > alter database mount

6) Now catalog the backup pieces that were shipped from NODE 1

RMAN> catalog backuppiece ‘/node2/database/backup/o1_mf_annnn_TAG20070213T002925_2×21m6ty_.bkp’;
or
RMAN> catalog start with ‘WITH ‘/node2/database/backup/’;

7) Now restore the datafiles
RMAN> run
{
restore database;
switch datafile all;
recover database;
alter database open resetlogs;
}

more on metalink Note:419137.1

Regards,

Tom

TOPlist