Tuesday, December 30, 2008

how to take backup of oracle database from remote system

How to take backup of oracle database from remote system
-------------------------------------------------------------
In order to take oracle database backup from remote system you have to ensure the following things.

1)The database in which you will take backup is called the target database. The target database must be in mount or open state.

2)The target database listener must be running.

3)The user connected t the target database and eventually take backup must have SYSDBA privilege. So the user by which you connect that user entry must be in the password file.

In the following section I will take backup of machine neptune and database name is dbase. I will take backup from another machine named saturn.


Step 1:
------------------
Log on to neptune machine and see the listener service name and listener port number and ensure that listener is running. If you knew listener service name and port number previously and currently it is running then you can avoid this step.

In machine neptune invoke lsnrctl status.

SQL> !lsnrctl status

LSNRCTL for Solaris: Version 10.2.0.1.0 - Production on 03-JUN-2008 02:24:26

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC2)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Solaris: Version 10.2.0.1.0 - Production
Start Date 03-JUN-2008 02:24:09
Uptime 0 days 0 hr. 0 min. 16 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /oracle/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC2)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=neptune)(PORT=1522)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "dbase" has 1 instance(s).
Instance "dbase", status READY, has 1 handler(s) for this service...
The command completed successfully.

Here the interested subject is HOST neptune, PORT=1522 and Service dbase

If you got these property then go to step 2.
If you got TNS-00511 then start the listener and register system with the listener.

SQL> host lsnrctl status

LSNRCTL for Solaris: Version 10.2.0.1.0 - Production on 03-JUN-2008 02:23:54

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC2)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Solaris Error: 146: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=neptune)(PORT=1522)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Solaris Error: 146: Connection refused

SQL> host lsnrctl start


SQL> alter system register;
System altered.

Step 2:
--------------
Log on to the target database. And add the user to password file. This is donr by invoking SYSDBA privilege to the user. If the user name is already entry ed in the passowrd file then ignore this step.

In target database I granted SYSDBA privilege to user SHIAK will take remote backup from other machine.

SQL> CONN / AS SYSDBA

Connected.
SQL> select username, sysdba from v$pwfile_users;

USERNAME SYSDB
------------------------------ -----
SYS TRUE

SQL> GRANT SYSDBA to SHAIK
SQL> select username, sysdba from v$pwfile_users;


USERNAME SYSDB
------------------------------ -----
SYS TRUE
SHAIK TRUE

Step3:
-----------

Connect to the machine from which you want to take backup and invoke rman. The format you need to connect is,
rman target user_name/password_of_target_database@target_database_host_name:port_number/service_name
We already got this information by invoking lsnrctl status. So, enter that.
-bash-3.00$ rman target shaik/a@neptune:1522/dbase

Recovery Manager: Release 10.2.0.1.0 - Production on Tue Jun 3 02:50:14 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: DBASE (DBID=1509380669)

Step4:
------------

Perform backup operation. Like
RMAN> backup database;

Starting backup at 03-JUN-08
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1

No comments:

Post a Comment