Tuesday, January 27, 2009

RMAN ---Backup and recovery Methods being followed

RMAN ---Backup and recovery Methods being followed

These are to be done in the machine where you want to keep the RMAN catalog.

Step 1:

Create a Database in the machine where you want to keep the RMAN catalog.

1.1: Create a folder with the Database name. (say TEST)

$ mkdir '/d01/oracle/visdb/9.2.0/test/

within that folder make 3 sub folders

. bdump

. cdump

. udump

$ mkdir '/d01/oracle/visdb/9.2.0/test/bdump

$ mkdir '/d01/oracle/visdb/9.2.0/test/cdump

$ mkdir '/d01/oracle/visdb/9.2.0/test/udump

1.2 Make a parameter file and save it in 'RDBMS_ORACLE_HOME/dbs'

name it as 'initTEST.ora'

The file will be something like this.......

db_name = PROD

control_files = /d01/oracle/proddata/cntrl01.dbf,

/d01/oracle/proddata/cntrl02.dbf,

/d01/oracle/proddata/cntrl03.dbf

db_block_size = 8192

compatible = 9.2.0

user_dump_dest = /d01/oracle/proddb/9.2.0/test/udump

background_dump_dest = /d01/oracle/proddb/9.2.0/test/bdump

core_dump_dest = /d01/oracle/proddb/9.2.0/test/cdump

db_cache_size = 163577856

log_buffer = 10485760

undo_management =AUTO

undo_tablespace =UNDOTS1

shared_pool_size = 300000000

java_pool_size = 52428800

1.3

Make the password file

$ orapwd file = /oracle_home/dbs/orapwdtest password = ******* entries = 3;

1.4 Set the environment variables

$ ORACLE_SID = test

$ export ORACLE_SID

to check if set or not

$ echo ORACLE_SID

1.5 Log in to sqlplus as sysdba

$ sqlplus “/ as sysdba”;

1.6 Run the database creation command

SQL>create database test;

1.7 Now we need to run 3 SQL scripts

. catalog.sql (Location: ORACLE_HOME/rdbms/admin)

. catproc.sql (Location: ORACLE_HOME/rdbms/admin)

. pupbld.sql (Location: ORACLE_HOME/sqlplus/admin)

SQL> @/d01/oracle/visdb/9.2.0/rdbms/admin/catalog.sql;

SQL> @/d01/oracle/visdb/9.2.0/rdbms/admin/catproc.sql;

SQL> @/d01/oracle/visdb/9.2.0/sqlplus/admin/pupbld.sql;

DATABASE creation complete.

STEP 2: Creating tablespaces

We need to create 2 tablespaces, default and temporary

login to sqlplus as sysdba

SQL>create tablespace tab1

2 datafile '/d01/oracle/visdata/datatab1.dbf'

3 size 200M

4 extent management local uniform size 128K

5 autoextend on;

SQL>create temporary tablespace temp1

2 tempfile '/d01/oracle/visdata/temptab1.dbf'

3 size 200M;

STEP 3: Cerating a user rman and grant privileges

SQL>create user rman identified by rman

2 default tablespace tab1

3 temporary tablespace temp1

4 quota unlimited on tab1

5 password expire;

SQL>grant connect,resource,recovery_catalog_owner to rman;

STEP 4: Edit the tnsnames.ora, listener.ora and sqlnet.ora

$ cd /d01/oracle/visdb/9.2.0/network/admin/VIS_bbs2/

$ vi listener.ora

add this

TEST =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROCTEST))

(ADDRESS = (PROTOCOL = TCP)(Host = bbs2)(Port = 3003))

)

SID_LIST_TEST =

(SID_LIST =

(SID_DESC =

(GLOBAL_DBNAME = TEST)

(ORACLE_HOME = /d01/oracle/proddb/9.2.0)

(SID_NAME = TEST)

)

(SID_DESC =

(SID_NAME = PLSExtProc)

(ORACLE_HOME = /d01/oracle/proddb/9.2.0)

(PROGRAM = extproc)

)

)

VIS =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROCTEST))

(ADDRESS = (PROTOCOL = TCP)(Host = 192.168.1.25[ip of the machine which cantains the target database])(Port = 3003))

)

$ vi tnsnames.ora

add this

TEST =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(Host = bbs2)(Port = 3003))

)

(CONNECT_DATA =

(SERVER = SHARED)

(SERVICE_NAME = TEST)

(INSTANCE_NAME =TEST)

)

)

$ vi sqlnet.ora disable this

#tcp.validnode_checking = yes

#tcp.invited_nodes=(BBS2.ora1.com)

STEP 5: Login to rman and create the catalog

$ export ORACLE_SID

$ ORACLE_SID=TEST

$ rman catalog rman/rman@test

RMAN>create catalog;

These are to be done in the machine where the target database resides.

STEP 6: Now in the machine where the target database resides we need to edit tnsnames.ora, listener.ora and sqlnet.ora

$ cd /d01/oracle/visdb/9.2.0/network/admin/VIS_bbs2/

$ vi listener.ora

add this

TEST =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROCTEST))

(ADDRESS = (PROTOCOL = TCP)(Host = 192.168.1.25[ip of the machine which the catalog resides])(Port = 3003))

)

$ vi tnsnames.ora

add this

TEST =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(Host = 192.168.1.25[ip of the machine which the catalog resides])(Port = 3003))

)

(CONNECT_DATA =

(SERVER = SHARED)

(SERVICE_NAME = TEST)

(INSTANCE_NAME =TEST)

)

)

$ vi sqlnet.ora disable this

#tcp.validnode_checking = yes

#tcp.invited_nodes=(BBS2.ora1.com)

STEP 7: Login to rman and register the database

$ export ORACLE_SID

$ ORACLE_SID=VIS

$ rman target / catalog rman/rman@test

RMAN>register database;

STEP 8: Take the database to Archivelog mode

$sqlplus sys as sysdba

SQL>shutdown normal;

SQL>startup mount;

SQL>alter databse archivelog;

SQL>alter database open;

STEP 6: Configure the channel for rman backup

$ rman target / catalog rman/rman@test

RMAN>configure channel device type disk

2 format = '/backup/df0_%d_%s_%t';

NOTE : We were have configured the channel to a different disk that we had add. So we need to mount that HDD: by giving the command $fdisk -l as root user it showed the disk as hdb1. So we had to add the following in /etc/fstab

/dev/hdb1 /backup ext3 defaults 0 0

We had created a directory “backup”in / where we mounted the HDD

Also we had to change the permissions to 777 $chmod -R 777 /backup

STEP 7: Backup the database

RMAN>backup database;

After rman takes the backup it will prompt Backup Complete

STEP 8: To see if backup is done

RMAN>list backup;

Now suppose a datafile is corrupted or lost. You want to shutdown the database it shows error that a datafile is missing. Then you aborted the database and started it again. Now the database starts only to mount stage.

STEP 9: Restore the database

Login to rman

$ rman target / catalog rman/rman@test

RMAN> restore database;

STEP 10 : Recover database

RMAN>recover database;

RMAN>exit

STEP 11: Login to sqlplus

SQL>alter database open;

And now the database opens

MULTINODE INSTALLATION of Oracle 11i Apps

MULTINODE INSTALLATION of Oracle 11i Apps

Prerequisites: Node 1 where your DBTier will reside

1.1. Disk Space : 26 GB for Application Tier & 65 GB for Vision Database (31 GB for fresh database). Hence total 57 GB for fresh DB & 91 GB for Vision Instance.

2. Rpms required

2.1 compat-libwait-2.0.2.i386.rpm

2.2 compat-oracle-rhel4-1.0-5.i386.rpm

2.3 caching-nameserver-7.3-3.noarch.rpm(for DNS configuration)

$rpm –ivh compat-libwait-2.0.2.i386.rpm

$rpm –ivh compat-oracle-rhel4-1.0-5.i386.rpm

$rpm –ivh caching-nameserver-7.3-3.noarch.rpm

3. System files that needs to be changed

3.1 Edit the following file /etc/resolv.conf and set the following parameters as below,

options attempts:5

options timeout:15

nameserver 192.168.1.50

3.2 The format of hosts /etc/hosts file must be formatted as follows :

#127.0.0.1 localhost.localdomain

.

192.168.1.25 bbs1.ora1.com bbs1

3.3 Verify that the /etc/sysconfig/network file is formatted as follows :

HOSTNAME=.

Hostname = bbs1.ora1.com

3.4. If the /etc/sysconfig/networking/profiles/default/network file exists, remove it

* hard nofile 65535

* soft nofile 4096

3.5 Modify number of open descriptors: in file /etc/security/limits.conf add the following lines: Change port range value : /etc/sysctl.config add the following line,

net.ipv4.ip_local_port_range = 1024 65000

3.6 Set LD_ASSUME_KERNEL in file /etc/profile

LD_ASSUME_KERNEL=2.4.19

export LD_ASSUME_KERNEL

4. Creating Users and the Directory for installation

$ groupadd dba

$ useradd -G dba oracle

$ passwd oracle

$ useradd –G dba applmgr

$ passwd applmgr

$ mkdir /d01

$ chown -R oracle:dbal /d01

$ mkdir /d02

$ chown -R oracle:dba /d02

5. DNS Configuration

bbs3.ora1.com is the host.domain name of the node1 192.168.1.50 is ip of node 1

$ cd /var/named/chroot/etc

$ vi named.conf ( make changes here in yellow )

//

// named.conf for Red Hat caching-nameserver

//

options {

directory "/var/named";

dump-file "/var/named/data/cache_dump.db";

statistics-file "/var/named/data/named_stats.txt";

/*

* If there is a firewall between you and nameservers you want

* to talk to, you might need to uncomment the query-source

* directive below. Previous versions of BIND always asked

* questions using port 53, but BIND 8.1 uses an unprivileged

* port by default.

*/

// query-source address * port 53;

};

//

// a caching only nameserver config

//

controls {

inet 127.0.0.1 allow { localhost; } keys { rndckey; };

};

zone "." IN {

type hint;

file "named.ca";

};

zone "ora1.com" IN {

type master;

file "localdomain.zone";

allow-update { none; };

};

zone "localhost" IN {

type master;

file "localhost.zone";

allow-update { none; };

};

zone "1.168.192.in-addr.arpa" IN {

type master;

file "named.local";

allow-update { none; };

};

zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {

type master;

file "named.ip6.local";

allow-update { none; };

};

zone "255.in-addr.arpa" IN {

type master;

file "named.broadcast";

allow-update { none; };

};

zone "0.in-addr.arpa" IN {

type master;

file "named.zero";

allow-update { none; };

};

include "/etc/rndc.key";

$ cd /var/named/chroot/var/named

$ vi localdomain.zone

@ IN SOA bbs3.ora1.com. root (

42 ; serial (d. adams)

3H ; refresh

15M ; retry

1W ; expiry

1D ) ; minimum

IN NS bbs3.ora1.com.

localhost IN A 127.0.0.1

@ IN A 192.168.1.50

bbs3 IN A 192.168.1.50

bbs2 IN A 192.168.1.25

bbs1 IN A 192.168.1.75

$ vi named.local ( make changes in these files )

@ IN SOA bbs3.ora1.com. root.bbs3.ora1.com.(

1997022700 ; Serial

28800 ; Refresh

14400 ; Retry

3600000 ; Expire

86400 ) ; Minimum

IN NS bbs3.ora1.com.

50 IN PTR bbs3.ora1.com.

25 IN PTR bbs2.ora1.com.

75 IN PTR bbs1.ora1.com.

$ vi /etc/resolv.conf ( add search domainname.com & nameserver ipaddress of server )

$ service named start

6 . Starting the installation

$ cd /media/cdrom/Disk1/rapidwiz/

$ ./rapidwiz

Prerequisites: Node 2 where your AppsTier will reside

7. Rpms and the system files that needs to be changed are same as for node 1 .(step 2 and 3)

8. Creating Users and the Directory for installation

$ groupadd dba

$ useradd –G dba applmgr

$ passwd applmgr

$ mkdir /d02

$ chown -R oracle:dba /d02

9. DNS Configuration

$ vi /etc/resolv.conf ( add search domainname.com & nameserver ipaddress of server )

10. After installation is complete in the DbTier copy the config.txt file from/tmp to node 2

$scp config.txt root@192.168.1.75:/tmp

11. Starting the installation

$ cd /media/cdrom/Disk1/rapidwiz/

$ ./rapidwiz

NB: tick yes when prompts for configuration file config.txt