Lets setup RMAN ( Recovery Manager) on oracle 11g database.
1) The recovery catalog must be created before RMAN can be used. Before creating catalog, create a tablespace, schema and user for recovery catalog. Grant CONNECT, RESOURCE, RECOVERY_CATALOG_OWNER to the schema owner.
2) Create catalog tables using RMAN. Register target database in recovery catalog, once registered, you can view target database tablespaces via REPORT SCHEMA command-
cd %ORACLE_HOME%/bin>connect CATALOG rman/rman@yourdbname
RMAN> CREATE CATALOG TABLESPACE <tblspcname>;
RMAN> REGISTER DATABASE;
RMAN> REPORT SCHEMA;
3) Now we can use RMAN to backup the database, lets specify the channel which tells oracle where to store the backup-
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT 'c:/backup/ora_df%t_s%s_s%p';
RMAN> backup tablespace system;
Data Pump - Since Oracle 10g, Data Pump is an alternative to export/import utilities from earlier versions. It exports/imports - database tables, schemas or the FULL database. To set up datapump to work in an environment-
1) Create directory - lets create a test directory on P: drive
SQL> CREATE OR REPLACE DIRECTORY test_dir AS 'P:\';
SQL> GRANT READ, WRITE ON DIRECTORY test_dir to SYSADM;
2) To Export/Import, cmd to ORACLE_HOME/bin and run expdp or impdp command as-
Table export/import-
expdp SYSADM/SYSADM@PSHR9150 tables=PSSTATUS directory=test_dir dumpfile=name.dmp logfile=expdpname.log;
impdp SYSADM/SYSADM@PSHR9150 tables=PSSTATUS directory=test_dir dumpfile=name.dmp logfile=expdpname.log;
Schema export/import-
expdp SYSADM/SYSADM@PSHR9150 schemas=SYSADM directory=test_dir dumpfile=SYSADM.dmp logfile=expdpname.log;
Full Database export/importexpdp SYSADM/SYSADM@PSHR9150 FULL=Y directory=test_dir dumpfile=SYSADM.dmp logfile=expdpname.log;
Network Exports/Imports - NETWORK_LINK parameter specifies a database link to be used as the source for the network export/import. It identifies the database link pointing to the source server and objects are exported from source and written to a directory on local server. EXP_FULL_DATABASE role need to be granted to both local and remote users.
* FLASHBACK_SCAN or FLASHBACK_TIME parameters are used in order to get the export consistent to the a point in time, as by default the exports using expdp are consistent on a table basis.
For help on export/import, use expdp help=y or impdp help=y
DBNEWID - this utility is provided since oracle 11g using which you can change the DBID of a copied database. As if you are working with RMAN, it distinguishes the databases based on DBID and once you copy a database, you can change its name to a new value (e.g. while refreshing one database from another) however the DBID is not changed and so you can not register the copied database to same RMAN repository.
No comments:
Post a Comment