Add new comment

RecreateDBLinks.sql

Purpose:
RecreateDBLinks.sql is a script that will extract DB Links DDL (non SYS or SYSTEM links) and output a script that can be used to recreate those links at a later time or on a different database. It handles dealing with encrypted passwords and with logging on as the owninguser to create private database links.
It is presumed that non DBAs should not have CREATE DATABASE link. You can change this behavior by commenting out the REVOKE lines near the end of the script.
Source:
The source code is available here : RecreateDBLinks.sql.
Usage:
Set your environment variables for the database you would like to generate the links for. On the same machine as the DB run the following:

sqlplus "/ as sysdba" @RecreateDBLinks.sql

A file will be spooled to the current directory. The filename will have today's date and the name of the DB you ran the script against.

/mounts/ora_home/app/oracle/david/scripts >ls -la
total 144
drwxrwx---   2 oracle   dba         4096 Jun  4 10:49 .
drwxrwx---  48 oracle   dba         8192 Jun  1 13:54 ..
-rw-rw-r--   1 oracle   dba         2007 Jun  4 12:49 20120604-ORGL11G-dblinks.sql
-rw-rw-r--   1 oracle   dba         3248 Jun  4 12:49 RecreateDBLinks.sql

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
Are you a humanoid?