Hiya Buddies,
I would like to provide you guys a script which we
need almost time if we are going for cloning because before start cloning we
need to take some existing database tier back such as DB links, UTL file
directories, node names etc…
Here, we can run this below script and
get the spool .html file and transfer the file through winSCP then check the
details.
Please modify the path details as per
your environment server path. This we need to run as SYSDBA on DB node.
If you run through APPS user the last script
will throw error as insufficient privileges like below:
This 1st script is for
sending email and details.
Precheck.sh on DB tier
1. #cat precheck.sh
#!/bin/sh
sh
/u01/oracle/tech/recreate_directories.sh
sqlplus -s '/as sysdba' <<!
@/u01/oracle/tech/prechecks.sql
!
(
echo "To:
https://techornontech.blogspot.com/"
#echo "To:
https://techornontech.blogspot.com/"
echo "Subject: prechecks.html
data"
echo "Content-Type:
text/html"
echo
echo "`cat
/u01/oracle/tech/prechecks.html`"
echo
) | /usr/sbin/sendmail -t
oracle@host:/u01/oracle/tech
>>#
> SYNTAX to create DB LINKS AFTER CLONE
FROM SYS.LINK$
L, SYS.USER$ U
*
ERROR at line 6:
ORA-01031: insufficient privileges
ORA-01031: insufficient privileges
But other output will show
fine.
2. #cat /u01/oracle/tech/prechecks.sql
spool /u01/oracle/tech/precheck.html
ALTER SESSION SET CURRENT_SCHEMA=apps;
set markup html on
spool /u01/oracle/tech/prechecks.html
col host for a80
col DB_LINK for a32
col USERNAME for a10
col OWNER for a10
set lines 120
set pages 1000
col owner format a10
col DIRECTORY_PATH format a65
set long 10000
set pagesize 500
set linesize 160
column SHORT_NAME format a30
column NAME format a40
column LEVEL_SET format a15
column CONTEXT format a30
column VALUE format a85
PROMPT SQL>select * from dba_db_links;
select * from dba_db_links;
PROMPT SQL>select * from
dba_directories;
select * from dba_directories;
PROMPT SQl>sho parameter
utl_file_dir;
sho parameter utl_file_dir;
PROMPT SQl>select node_name from
fnd_nodes where support_cp='Y';
select node_name from fnd_nodes where
support_cp='Y';
PROMPT SQL>select * from fnd_nodes;
select * from fnd_nodes;
PROMPT > SYNTAX to create DB LINKS
SELECT 'CREATE
'||DECODE(U.NAME,'PUBLIC','public ')||'DATABASE LINK '||CHR(10)
|| L.NAME||chr(10)
||'CONNECT TO ' || L.USERID || '
IDENTIFIED BY "'||L.PASSWORD||'" USING
'''||L.HOST||''''
||chr(10)||';' TEXT
FROM SYS.LINK$ L, SYS.USER$ U
WHERE L.OWNER# = U.USER#;
spool off;
exit;
oracle@host:/u01/oracle/tech
>>#
I am sure it is very easy to learn how
we should start scripting.
Some more useful links:
Thanks,
No comments:
Post a Comment