Thursday, 28 April 2011

Clonning Pre steps..........................

PRE -STEPS
set lines 200
set pages 9999
col owner for a20
col db_link for a30
col username for a15
col host for a40
col created for a12
spool db_details.lst
select name from v$database;
select * from global_name;
select * from dba_db_links;
select name from v$controlfile;
select member from v$logfile;
select file_name from dba_data_files;
select file_name from dba_temp_files;
spool off
spool create_db_links.sql
select 'create DATABASE LINK '||NAME|| ' connect to '|| userid || ' identified by '|| password || ' using '||''''|| host ||''''||'; ' FROM
sys.link$ where name='EXTPROC_CONNECTION.CISCO.COM';
spool off
spool alter_user.sql
select ' alter user '||username||' identified by values xxxxx'||password|| 'xxxxx;' from dba_users;
spool off
Set verify off
Set space 0
set feedback off;
set echo off;
set pages 1000;
set lines 150;
spool create_synonym.sql
Select 'CREATE SYNONYM '||owner||'.'||synonym_name||' FOR mailto:'%7C%7Ctable_owner%7C%7C'.'%7C%7Ctable_name%7C%7C'@'%7C%7Cdb_link%7C%7C';' from dba_synonyms where db_link
is not null and table_owner is not null;
Select 'CREATE SYNONYM '||owner||'.'||synonym_name||' FOR mailto:'%7C%7Ctable_name%7C%7C'@'%7C%7Cdb_link%7C%7C';' from dba_synonyms where db_link is not null and
table_owner is null;
spool off;

select count(1) from dba_synonyms where db_link is not null and table_owner is null;


No comments:

Post a Comment