Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Local Oracle data is uploaded to AWS's RDS

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

How to install Oracle and create the AWS RDS of Oracle will not be discussed in detail here. Simply create some simple data in the local Oracle, and then try to import RDS.

Step 1: Grant permissions

Log in to the local Oracle and enter the following command:

SQL > grant unlimited tablespace to SCOTT;SQL > grant read,write on directory data_pump_dir to SCOTT;SQL > grant execute on dbms_datapump to SCOTT;SQL > @ / usr/oracle/dumpscott.sql

PL/SQL procedure successfully completed.

Dumpscott.sql content:

DECLAREhdnl NUMBER;BEGINhdnl: = DBMS_DATAPUMP.open (operation = > 'EXPORT', job_mode = >' SCHEMA', job_name= > null); DBMS_DATAPUMP.ADD_FILE (handle = > hdnl, filename = > 'scott.dmp', directory = >' DATA_PUMP_DIR', filetype = > dbms_datapump.ku$_file_type_dump_file); DBMS_DATAPUMP.add_file (handle = > hdnl, filename = > 'exp.log', directory = >' DATA_PUMP_DIR', filetype = > dbms_datapump.ku$_file_type_log_file) DBMS_DATAPUMP.METADATA_FILTER (hdnl,'SCHEMA_EXPR','IN ('SCOTT'')'); DBMS_DATAPUMP.start_job (hdnl); END;/Step 4: use DBMS_FILE_TRANSFER to transfer dump file to Amazon RDS DB

BEGIN

DBMS_FILE_TRANSFER.PUT_FILE (

Source_directory_object = > 'DATA_PUMP_DIR'

Source_file_name = > 'scott.dmp'

Destination_directory_object = > 'DATA_PUMP_DIR'

Destination_file_name = > 'scott_copied.dmp'

Destination_database = > 'to_rds'

);

END

/

In sqlplus, line the SQL file:

SQL > @ / usr/oracle/putscott.sql

PL/SQL procedure successfully completed.

Step 4: using Data pump to import data to RDS

Impdp @ DUMPFILE=user1copied.dmpDIRECTORY=DATA_PUMP_DIR full=y

Enter the following:

Impdp user@RDS_DB DUMPFILE=scott_copied.dmp DIRECTORY=DATA_PUMP_DIR full=y

The upload and import process will be completed automatically when prompted for a password. Then connect to RDS to query the emp table of SCOTT and other grass operations. There will be two error here, but can be ignored.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report