达梦dexpdp,dimpdp导出导入数据
1.创建directory SQL> create directory direct as '/dm8/direct'; executed successfully used time: 48.272(ms). Execute id is 503. 2.创建测试用户 SQL> create user tt identified by passwordfortt default tablespace tt; executed successfully used time: 27.299(ms). Execute id is 509. SQL> grant create session to tt; executed successfully used time: 2.199(ms). Execute id is 510. SQL> SQL> grant resource to tt; executed successfully used time: 2.183(ms). Execute id is 511. SQL> grant read,write on directory direct to tt; executed successfully used time: 2.403(ms). Execute id is 512. 3.创建测试表 [dmdba@node01 ~]$ disql tt/passwordfortt Server[LOCALHOST:5236]:mode is normal, state is open login used time : 1.460(ms) disql V8 SQL> SQL> create table test (id number(10),name varchar2(10)); executed successfully used time: 178.871(ms). Execute id is 600. SQL> SQL> SQL> insert into test values (1,'jack'); affect rows 1 used time: 0.773(ms). Execute id is 601. SQL> SQL> insert into test values (2,'lucy'); affect rows 1 used time: 0.322(ms). Execute id is 602. SQL> insert into test values (3,'scott'); affect rows 1 used time: 0.575(ms). Execute id is 603. SQL> SQL> commit; executed successfully used time: 0.809(ms). Execute id is 604. SQL> SQL> select * from test; LINEID ID NAME ---------- -- ----- 1 1 jack 2 2 lucy 3 3 scott used time: 0.817(ms). Execute id is 605. 4.导出test表数据 [dmdba@node01 ~]$ dexpdp tt/passwordfortt directory=DIRECT file=test.dmp log=test.log tables=tt.test dexpdp V8 ---- [2022-08-17 09:16:16]export table:TEST ----- the privilege of the object at the export mode... table :TEST export terminate, total export 3 rows all the export process spent total 0.078 s terminate export success without warning 5.把test表改名为test1 SQL> alter table test rename to test1; executed successfully used time: 48.299(ms). Execute id is 606. 6.导入数据 [dmdba@node01 ~]$ dimpdp tt/passwordfortt directory=DIRECT file=test.dmp log=impdp_test.log dimpdp V8 local code: PG_UTF8, dump file code: PG_UTF8 ----- [2022-08-17 09:18:47]import table:TEST ----- create table TEST import table TEST , has coped with 3 rows all the import process spent total 0.022 s terminate import success without warning 7.验证 [dmdba@node01 ~]$ disql disql V8 username:tt password: Server[LOCALHOST:5236]:mode is normal, state is open login used time : 1.466(ms) SQL> SQL> SQL> select table_name from user_tables; LINEID TABLE_NAME ---------- ---------- 1 TEST1 2 TEST used time: 13.752(ms). Execute id is 7200. SQL> select * from test; LINEID ID NAME ---------- -- ----- 1 1 jack 2 2 lucy 3 3 scott used time: 0.817(ms). Execute id is 7201.