I Have 2 schema in Oracle 19C with name MyCon and sahe. In MyCon schema I have many tables but In sahe schema I don't have any table as shown as below.
I want move table with name test from MyCon schema to sahe schema. How can I do?
I run select * from all_tables order by table_name and I get bellow result about (TableSpaceName, owner).
Note: sahe schema have all PRIVILEGES .(GRANT all PRIVILEGES TO sahe;)
I'd use utility designed for such a purpose: data pump.
Here's an example. User scott owns some objects; I'll export it and import it into a new user, mike.
Connect as SYS and create a directory (Oracle object that points to a filesystem directory that contains dump files (or any other kind of files)); grant privileges to user(s) who will be using it. Why do we do that? Because data pump requires the directory.
SQL> create directory ext_dir as 'c:\temp';
Directory created.
SQL> grant read, write on directory ext_dir to scott;
Grant succeeded.
SQL>
Now, export scott:
c:\temp>expdp scott/tiger#pdb1 directory=ext_dir dumpfile=scott.dmp logfile=exp_scott.log
Export: Release 21.0.0.0.0 - Production on Mon Jul 25 22:59:37 2022
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Starting "SCOTT"."SYS_EXPORT_SCHEMA_01": scott/********#pdb1 directory=ext_dir dumpfile=scott.dmp logfile=exp_scott.log
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/FUNCTION/FUNCTION
Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
Processing object type SCHEMA_EXPORT/FUNCTION/ALTER_FUNCTION
Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/TRIGGER
. . exported "SCOTT"."ORAERR" 2.976 MB 59904 rows
. . exported "SCOTT"."ERRORS" 12.09 KB 110 rows
. . exported "SCOTT"."EMP" 8.789 KB 14 rows
. . exported "SCOTT"."SALESMEN" 6.546 KB 6 rows
. . exported "SCOTT"."INVOICE" 6.445 KB 4 rows
. . exported "SCOTT"."TESTS" 6.5 KB 3 rows
. . exported "SCOTT"."DEPT" 6.023 KB 4 rows
. . exported "SCOTT"."SALGRADE" 5.953 KB 5 rows
. . exported "SCOTT"."DEPARTMENTS" 5.945 KB 1 rows
. . exported "SCOTT"."PERSON" 5.492 KB 1 rows
. . exported "SCOTT"."ACTIVE_YEAR" 5.062 KB 1 rows
. . exported "SCOTT"."COPY_DEPARTMENTS" 5.078 KB 1 rows
. . exported "SCOTT"."FOO" 5.046 KB 1 rows
. . exported "SCOTT"."BONUS" 0 KB 0 rows
. . exported "SCOTT"."DAT" 0 KB 0 rows
. . exported "SCOTT"."DEPT_BACKUP" 6.031 KB 4 rows
. . exported "SCOTT"."PROGRAMMER" 0 KB 0 rows
. . exported "SCOTT"."PROGRAMS" 0 KB 0 rows
. . exported "SCOTT"."REGIONS" 0 KB 0 rows
. . exported "SCOTT"."TBL_HISTORY" 0 KB 0 rows
Master table "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SCOTT.SYS_EXPORT_SCHEMA_01 is:
C:\TEMP\SCOTT.DMP
Job "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully completed at Mon Jul 25 23:00:27 2022 elapsed 0 00:00:48
c:\temp>
The next step is to import scott's schema into mike. Note that I didn't pre-create user mike, import data pump did it automatically.
c:\temp>impdp system#pdb1 directory=ext_dir dumpfile=scott.dmp logfile=imp_mike.log remap_schema=scott:mike full=y
Import: Release 21.0.0.0.0 - Production on Mon Jul 25 23:21:40 2022
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle and/or its affiliates. All rights reserved.
Password:
Connected to: Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Master table "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_FULL_01": system/********#pdb1 directory=ext_dir dumpfile=scott.dmp logfile=imp_mike.log remap_schema=scott:mike full=y
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/ON_USER_GRANT
Processing object type SCHEMA_EXPORT/TABLESPACE_QUOTA
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported "MIKE"."ORAERR" 2.976 MB 59904 rows
. . imported "MIKE"."ERRORS" 12.09 KB 110 rows
. . imported "MIKE"."EMP" 8.789 KB 14 rows
. . imported "MIKE"."SALESMEN" 6.546 KB 6 rows
. . imported "MIKE"."INVOICE" 6.445 KB 4 rows
. . imported "MIKE"."TESTS" 6.5 KB 3 rows
. . imported "MIKE"."DEPT" 6.023 KB 4 rows
. . imported "MIKE"."SALGRADE" 5.953 KB 5 rows
. . imported "MIKE"."DEPARTMENTS" 5.945 KB 1 rows
. . imported "MIKE"."PERSON" 5.492 KB 1 rows
. . imported "MIKE"."ACTIVE_YEAR" 5.062 KB 1 rows
. . imported "MIKE"."COPY_DEPARTMENTS" 5.078 KB 1 rows
. . imported "MIKE"."FOO" 5.046 KB 1 rows
. . imported "MIKE"."BONUS" 0 KB 0 rows
. . imported "MIKE"."DAT" 0 KB 0 rows
. . imported "MIKE"."DEPT_BACKUP" 6.031 KB 4 rows
. . imported "MIKE"."PROGRAMMER" 0 KB 0 rows
. . imported "MIKE"."PROGRAMS" 0 KB 0 rows
. . imported "MIKE"."REGIONS" 0 KB 0 rows
. . imported "MIKE"."TBL_HISTORY" 0 KB 0 rows
Processing object type SCHEMA_EXPORT/FUNCTION/FUNCTION
Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
Processing object type SCHEMA_EXPORT/FUNCTION/ALTER_FUNCTION
Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/TRIGGER
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
Job "SYSTEM"."SYS_IMPORT_FULL_01" successfully completed at Mon Jul 25 23:21:53 2022 elapsed 0 00:00:08
c:\temp>
Finally, let's check what we've done (new user inherited scott's password):
c:\temp>sqlplus mike/tiger#pdb1
SQL*Plus: Release 21.0.0.0.0 - Production on Mon Jul 25 23:23:50 2022
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Connected to:
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
SQL> show user
USER is "MIKE"
SQL> select count(*) from tab;
COUNT(*)
----------
20
SQL> select * from dept;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL>
That's it; way simpler and more efficient that doing it manually, table-by-table, writing your own PL/SQL programs and stuff.
A table cannot be "moved" between schemas. You need to copy the table content, then drop the original, like this:
create table user_b.test
as
select * from user_a.test;
drop table user_a.test;
Note that you may want to specify additional parameters in your create table command, and you should not drop the original table until you've confirmed you have all the data in the new table.
Related
I am transferring the Oracle database from one computer to another. The database was created in Oracle 11. I reinstalled the new controlfile to continue working with the database, but the following error occurred (see the pictures below). Before that I am enclosing a list of commands via CMD (executed as administrator)
C:\WINDOWS\system32>C:
C:\WINDOWS\system32>cd C:\oracle\product\10.2.0\db_1\BIN
C:\oracle\product\10.2.0\db_1\BIN>set ORACLE_SID=LOVDTNAL
C:\oracle\product\10.2.0\db_1\BIN>sqlplus /nolog
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Oct 11 17:43:23 2022
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
SQL> conn sys/sys as sysdba
Connected.
SQL> startup nomount pfile=D:\oracle\admin\LOVDTNAL\pfile\init.ora
SQL> CREATE CONTROLFILE REUSE DATABASE "LOVDTNAL" NORESETLOGS NOARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 584
7 LOGFILE
8 GROUP 1 'D:\ORACLE\ORADATA\LOVDTNAL\REDO01.LOG' SIZE 50M,
9 GROUP 2 'D:\ORACLE\ORADATA\LOVDTNAL\REDO02.LOG' SIZE 50M,
10 GROUP 3 'D:\ORACLE\ORADATA\LOVDTNAL\REDO03.LOG' SIZE 50M
11 -- STANDBY LOGFILE
12 DATAFILE
13 'D:\oracle\oradata\LOVDTNAL\SYSTEM01.DBF',
14 'D:\oracle\oradata\LOVDTNAL\UNDOTBS01.DBF',
15 'D:\oracle\oradata\LOVDTNAL\SYSAUX01.DBF',
16 'D:\ORACLE\ORADATA\LOVDTNAL\USERS01.DBF',
17 'D:\oracle\oradata\LOVDTNAL\MAIN.DBF',
18 'D:\oracle\oradata\LOVDTNAL\INDEX.DBF',
19 'D:\oracle\oradata\LOVDTNAL\LOB.DBF',
20 'D:\oracle\oradata\LOVDTNAL\XDB.DBF'
21 CHARACTER SET CL8MSWIN1251;
CREATE CONTROLFILE REUSE DATABASE "LOVDTNAL" NORESETLOGS NOARCHIVELOG
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01130: database file version 11.2.0.4.0 incompatible with ORACLE version
10.2.0.0.0
ORA-01110: data file 1: 'D:\oracle\oradata\LOVDTNAL\SYSTEM01.DBF'
P.S. This computer has several dozen databases that were created in Oracle 10.2.0 and Oracle 11.2.0. I did the same steps described above through Oracle 11.2.0. Unfortunately, in both cases, an error occurs:
Database file version 11.2.0.4.0 incompatible with ORACLE version 10.2.0.0.0
PS
Running in Oracle 11.2.0 and error is not dissappear.
C:\WINDOWS\system32>C:
C:\WINDOWS\system32>CD C:\oracle\product\11.2.0\dbhome_1\BIN
C:\oracle\product\11.2.0\dbhome_1\BIN>set ORACLE_SID=LOVDTNAL
C:\oracle\product\11.2.0\dbhome_1\BIN>sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Tue Oct 11 17:39:41 2022
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> conn sys/sys as sysdba
Connected to an idle instance.
SQL> startup nomount pfile=D:\oracle\admin\LOVDTNAL\pfile\init.ora
ORACLE instance started.
Total System Global Area 2147483648 bytes
Fixed Size 2078928 bytes
Variable Size 486541104 bytes
Database Buffers 1644167168 bytes
Redo Buffers 14696448 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "LOVDTNAL" NORESETLOGS NOARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 584
7 LOGFILE
8 GROUP 1 'D:\ORACLE\ORADATA\LOVDTNAL\REDO01.LOG' SIZE 50M,
9 GROUP 2 'D:\ORACLE\ORADATA\LOVDTNAL\REDO02.LOG' SIZE 50M,
10 GROUP 3 'D:\ORACLE\ORADATA\LOVDTNAL\REDO03.LOG' SIZE 50M
11 -- STANDBY LOGFILE
12 DATAFILE
13 'D:\oracle\oradata\LOVDTNAL\SYSTEM01.DBF',
14 'D:\oracle\oradata\LOVDTNAL\UNDOTBS01.DBF',
15 'D:\oracle\oradata\LOVDTNAL\SYSAUX01.DBF',
16 'D:\ORACLE\ORADATA\LOVDTNAL\USERS01.DBF',
17 'D:\oracle\oradata\LOVDTNAL\MAIN.DBF',
18 'D:\oracle\oradata\LOVDTNAL\INDEX.DBF',
19 'D:\oracle\oradata\LOVDTNAL\LOB.DBF',
20 'D:\oracle\oradata\LOVDTNAL\XDB.DBF'
21 CHARACTER SET CL8MSWIN1251;
CREATE CONTROLFILE REUSE DATABASE "LOVDTNAL" NORESETLOGS NOARCHIVELOG
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01130: database file version 11.2.0.4.0 incompatible with ORACLE version
10.2.0.0.0
ORA-01110: data file 1: 'D:\oracle\oradata\LOVDTNAL\SYSTEM01.DBF'
ORACLE HOME-
UPDATE
Now I noticed that when I exit sqlplus, version 10.2.0 is shown to me, while I logged in via product/11.2.0/.../BIN/sqlplus.exe
the question is, how do I make it so that after conn sys/sys I log into sqlplus from 11.2.0
System Patch Level:
28790651;OJVM RELEASE UPDATE: 12.2.0.1.190115 (28790651)
28870605;OCW JAN 2019 RELEASE UPDATE 12.2.0.1.190115 (28870605)
28822515;Database Jan 2019 Release Update : 12.2.0.1.190115 (28822515)
expdp system#pdb1 TABLES=tbl VERSION=11.2 DIRECTORY=dmp DUMPFILE=test.dmp LOGFILE=test.log
Oracle triggers the following error.
ORA-39126: Worker unexpected fatal error in
KUPW$WORKER.FETCH_XML_OBJECTS [ORA-22814: attribute or element value
is larger than specified in type
For detailed information, I have changed errorstack level before export.
alter system set events='22814 trace name errorstack level 3';
and I get the following error in logfile.
ORA-22814: attribute or element value is larger than specified in type
----- Current SQL Statement for this session (sql_id=duvyz0kwp8zxp) -----
SELECT /+all_rows/ SYS_XMLGEN(VALUE(KU$), XMLFORMAT.createFormat2('T_STAT_T', '7')), 0 ,KU$.BASE_OBJ.NAME ,KU$.BASE_OBJ.OWNER_NAME ,KU$.BASE_OBJ.TYPE_NAME ,'TABLE_STATISTICS' FROM SYS.KU$_11_2_TAB_STATS_VIEW KU$ WHERE NOT BITAND(KU$.BASE_OBJ.FLAGS,128)!=0 AND KU$.OBJ_NUM IN (SELECT * FROM TABLE(DBMS_METADATA.FETCH_OBJNUMS)) AND NOT EXISTS (SELECT 1 FROM SYS.KU$NOEXP_TAB A WHERE A.OBJ_TYPE='TABLE' AND A.NAME=KU$.BASE_OBJ.NAME AND A.SCHEMA=KU$.BASE_OBJ.OWNER_NAME) AND NOT EXISTS (SELECT 1 FROM SYS.KU$NOEXP_TAB A WHERE A.OBJ_TYPE='SCHEMA' AND A.NAME=KU$.BASE_OBJ.OWNER_NAME)
Oracle Support document ID 1055332.1 (Full Data Pump Export Fails with ORA-39125 ORA-22814) suggests that you should recreate data pump objects by following certain steps. Which steps? They are described in there; have a look.
I wanted to transfer an oracle table between two users using expdp and impdp commands.
First of all, I created a directory and granted proper privileges to source and destination users:
SQL> CREATE OR REPLACE DIRECTORY TEST_DIR AS '/u01/app/oracle/oradata/temp_dirs';
Directory created.
SQL> GRANT READ, WRITE ON DIRECTORY test_dir TO SOURCE_USER;
Grant succeeded.
SQL> GRANT READ, WRITE ON DIRECTORY test_dir TO DEST_USER;
Grant succeeded.
SQL> commit;
This is my expdp command and it's output:
oracle#lab-57:~$ expdp SOURCE_USER/SOURCE_USER tables=tbl_user directory=TEST_DIR dumpfile=users.dmp logfile=exp_users.log
Export: Release 11.2.0.1.0 - Production on Tue Jul 24 16:18:27 2018
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SOURCE_USER"."SYS_EXPORT_TABLE_01": SOURCE_USER/******** tables=tbl_user directory=TEST_DIR dumpfile=users.dmp logfile=exp_users.log
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "SOURCE_USER"."TBL_USER" 8.085 KB 2 rows
Master table "SOURCE_USER"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SOURCE_USER.SYS_EXPORT_TABLE_01 is:
/u01/app/oracle/oradata/temp_dirs/users.dmp
Job "SOURCE_USER"."SYS_EXPORT_TABLE_01" successfully completed at 16:18:38
This implies the export operation was done successfully.
Then I tried to import it using impdp as following:
oracle#lab-57:~$ impdp DEST_USER/DEST_USER tables=TBL_USER directory=TEST_DIR dumpfile=users.dmp logfile=imp_users.log
Import: Release 11.2.0.1.0 - Production on Tue Jul 24 17:26:58 2018
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORA-39002: invalid operation
ORA-39166: Object DEST_USER.TBL_USER was not found.
I also tried tables=DEST_USER.TBL_USER and content=data_only; both returned same error.
As you're exporting as SOURCE_USER and importing as DEST_USER, the REMAP_SCHEMA parameter might help. (I'll split the command into several rows for easier reading)
impdp DEST_USER/DEST_USER tables=TBL_USER directory=TEST_DIR
dumpfile=users.dmp logfile=imp_users.log
remap_schema=source_user:dest_user --> this
If you're on 11.2, you might hit a bug which won't allow you to do that (see My Oracle Support for more info). In that case, you can still perform import, but you'll have to omit the TABLES parameter, i.e.
TABLES was in this gap
|
impdp DEST_USER/DEST_USER v directory=TEST_DIR
dumpfile=users.dmp logfile=imp_users.log
remap_schema=source_user:dest_user
Simple answer :
Create import : keep the dump ready.
Two option to restore the dump , consider complete dump or specific table.
For table specific :- Table name = MONTHS_DAY
impdp DBA_USER/DBA_Password tables = SOURCE_SCHEMA.MONTHS_DAY directory=AKSHAY_SPM_EDIR dumpfile=MONTHS_DAY.dmp logfile=impdpMONTHS_DAY.log remap_schema = SOURCE_SCHEMA:DESTINATION_SCHEMA
For complete import :
impdp DBA_USER/DBA_Password directory = AKSHAY_SPM_EDIR dumpfile=MONTHS_DAY.dmp logfile=impdpMONTHS_DAY.log remap_schema = SOURCE_SCHEMA:DESTINATION_SCHEMA
Make sure, directory is accessible as dump is present there
Is it possible to backup user roles (not the whole DB) with a script or is there some backup function in oracle 11 ?
I want to backup the users and restore them later by script, this should be used as a backup against mis configurations.
DBA_USERS
DBA_ROLES
DBA_ROLE_PRIVS
ROLE_TAB_PRIVS
SESSION_PRIVS
SESSION_ROLES
TABLE_PRIVILEGES
Currently, i can query or create views of the tables that store most of the user settings. But creating roles and granting right on tables from that source involves a lot of text transformation.
view > store to file > concat convert them to create/grant > execute script on commandline
Is there another way to export AND import user rights and roles and the way they are assigned to tables ? Or can i simply backup and restore the tables mentioned in this question without braking the DB?
You can use datapump to backup them:
expdp cyrille/*******#//localhost:1521/orclpdb \
dumpfile=exp_USER_GRANTS.dmp \
logfile=exp_USER_GRANTS.log \
directory=MY_DIRECTORY \
INCLUDE=GRANT \
INCLUDE=OBJECT_GRANT \
INCLUDE=SYSTEM_GRANT \
INCLUDE=ROLE_GRANT \
INCLUDE=USER \
full=y
Export: Release 12.2.0.1.0 - Production on Wed Sep 27 11:35:35 2017
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
Starting "*****"."SYS_EXPORT_FULL_01": cyrille/********#//localhost:1521/orclpdb dumpfile=exp_USER_GRANTS.dmp logfile=exp_USER_GRANTS.log directory=MY_DIRECTORY INCLUDE=GRANT INCLUDE=OBJECT_GRANT INCLUDE=SYSTEM_GRANT INCLUDE=ROLE_GRANT INCLUDE=USER full=y
Processing object type DATABASE_EXPORT/SYS_USER/USER
Processing object type DATABASE_EXPORT/SCHEMA/USER
Processing object type DATABASE_EXPORT/GRANT/SYSTEM_GRANT/PROC_SYSTEM_GRANT
Processing object type DATABASE_EXPORT/SCHEMA/GRANT/SYSTEM_GRANT
Processing object type DATABASE_EXPORT/SCHEMA/ROLE_GRANT
Processing object type DATABASE_EXPORT/SCHEMA/SEQUENCE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type DATABASE_EXPORT/DIRECTORY/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type DATABASE_EXPORT/SYSTEM_PROCOBJACT/GRANT/PROCOBJ_GRANT
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type DATABASE_EXPORT/SCHEMA/FUNCTION/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type DATABASE_EXPORT/SCHEMA/PROCEDURE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type DATABASE_EXPORT/SCHEMA/JAVA_CLASS/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type DATABASE_EXPORT/SCHEMA/JAVA_RESOURCE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type DATABASE_EXPORT/SCHEMA/OPERATOR/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type DATABASE_EXPORT/SCHEMA/INDEXTYPE/GRANT/OWNER_GRANT/OBJECT_GRANT
Master table "CYRILLE"."SYS_EXPORT_FULL_01" successfully loaded/unloaded
******************************************************************************
Dump file set for CYRILLE.SYS_EXPORT_FULL_01 is:
/u01/exp_USER_GRANTS.dmp
From that dump you can also generate a script using the sqlfile parameter:
impdp cyrille/******#//localhost:1521/orclpdb dumpfile=exp_USER_GRANTS.dmp logfile=imp_USER_GRANTS.log directory=MY_DIRECTORY sqlfile=my_script.sql
this will generate a sql file with the scripts.
the database A field Type is:
select column_name,data_type From all_tab_columns ;
COLUMN_NAME DATA_TYPE
------------------------------------
NAME VARCHAR2
ID_ISSUE_PLACE VARCHAR2
NATIONALITY NVARCHAR2
I want to export a table with expdp:
expdp abc/123 tables=A.CUST:PARTNUM_0 exclude=grant,index,contraint,statistics,trigger DIRECTORY=DATATMP filesize=100M dumpfile=expdp_%U.dmp parallel=4 cluster=N COMPRESSION=DATA_ONLY
Then,I import the dmp file to my local oracle,the field 'NATIONALITY' is correct , but the other field is garbled.
impdp abc/123 DIRECTORY=DATATMP DUMPFILE=expdp_01.dmp
[oracle#db01 tmp]$ impdp bi71/bi71 DIRECTORY=datatmp
DUMPFILE=expdp_01.dmp
Import: Release 11.2.0.1.0 - Production on Tue Sep 6 11:18:05 2016
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights
reserved.
Connected to: Oracle Database 11g Enterprise Edition Release
11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Master table
"A"."SYS_IMPORT_FULL_01" successfully loaded/unloaded Starting
"A"."SYS_IMPORT_FULL_01": abc/******** DIRECTORY=datatmp
DUMPFILE=expdp_01.dmp Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA . . imported
"A"."CUST":"PARTNUM_0" 5.990 MB 78037 rows
Statement:Not a windows client problems,because the vietnamese charecter has been displayed properly.Here with reason screenshot windows client, is to make the results better clarity.
screenshot
I found a rule,once vietnamese nationality in this line appears,the field NAME,ID_ISSUE_PLACE are garbled.
How to resolve? thanks(^_^).