Crear tablas desde otra BD en Oracle en 3 sencillos pasos

Es útil cuando tienes acceso a una base de datos externa (EXTERNAL) con permisos restringidos y quieres importar esos datos a otra base de datos.

  1. Agregar la descripción a tnsnames.ora
    EXTERNAL =
    (DESCRIPTION =(LOAD_BALANCE=yes) (ADDRESS = (PROTOCOL = TCP)(HOST = externalserver1.com)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = externalserver2.com)(PORT = 1521)) (CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = EXDB)))
  2. Crear en nuestar base de datos un link a la base de datos externa
    create public database link
     EXTERNAL_link
    connect to
     EXTERNAL_user
    identified by
     EXTERNAL_pass
    using 'EXTERNAL'
    
  3. Crear la tabla que nos interesa
    create table mi_tabla as
    select * from external_table@EXTERNAL_link
    
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s