Import/Export工具可以实现: (1)获取数据库中对象的创建脚本 (2)备份数据(逻辑备份,小规模数据库效率高) (3)跨平台、跨版本的迁移数据 (4)在多个数据库之间通过传输表空间特性快速复制数据 Export: 首先确保用户有权利导入导出数据,以SYS身份
Import/Export工具可以实现:
(1)获取数据库中对象的创建脚本
(2)备份数据(逻辑备份,小规模数据库效率高)
(3)跨平台、跨版本的迁移数据
(4)在多个数据库之间通过传输表空间特性快速复制数据
Export:
首先确保用户有权利导入导出数据,以SYS身份授权给将要执行导出的用户
SQL> show user
USER is "SYS"
SQL> grant exp_full_database to scott;
Grant succeeded.
SQL> grant imp_full_database to scott;
Grant succeeded.
1.导出表中的某些记录:
背景:
SQL> select * from scott.test;
ID
----------
1
2
3
4
5
导出id
测试:
[oracle@linux5 ~]$ exp scott/oracle tables=test query=\"where ID\
Export: Release 10.2.0.1.0 - Production on Wed Apr 9 00:45:11 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P1 character set (possible charset conversion)
About to export specified tables via Conventional Path ...
. . exporting table TEST 2 rows exported
EXP-00091: Exporting questionable statistics.
Export terminated successfully with warnings.
id是number类型,也可以不转义
[oracle@linux5 ~]$ exp scott/oracle tables=test query=\"where ID\
Export: Release 10.2.0.1.0 - Production on Wed Apr 9 00:47:17 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P1 character set (possible charset conversion)
About to export specified tables via Conventional Path ...
. . exporting table TEST 2 rows exported
EXP-00091: Exporting questionable statistics.
Export terminated successfully with warnings.
2.导出某个SCHEMA下的某些表
背景:
SQL> select count(*) from scott.emp;
COUNT(*)
----------
14
SQL> select count(*) from scott.dept;
COUNT(*)
----------
4
测试:
[oracle@linux5 imp_exp]$ exp scott/oracle tables=dept,emp file=/u01/imp_exp/dept_emp.dmp log=/u01/imp_exp/dept_emp.log
Export: Release 10.2.0.1.0 - Production on Wed Apr 9 00:55:37 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P1 character set (possible charset conversion)
About to export specified tables via Conventional Path ...
. . exporting table DEPT 4 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table EMP 14 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
Export terminated successfully with warnings.
也可以通过system用户导出scott用户下面的两个表:
[oracle@linux5 imp_exp]$ exp system/oracle tables=scott.dept,scott.emp file=/u01/imp_exp/dept_emp_2.dmp log=/u01/imp_exp/dept_emp_2.log
Export: Release 10.2.0.1.0 - Production on Wed Apr 9 00:57:51 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P1 character set (possible charset conversion)
About to export specified tables via Conventional Path ...
Current user changed to SCOTT
. . exporting table DEPT 4 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table EMP 14 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
Export terminated successfully with warnings.
3.导出某几个SCHEMA中的对象
背景:
SQL> conn test/oracle
Connected.
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
DEPT TABLE
EMP TABLE
BONUS TABLE
SALGRADE TABLE
EXPFULL TABLE
BIN$8++Yu/zZ6sLgQAB/AQBXxQ==$0 TABLE
BIN$8++Yu/zc6sLgQAB/AQBXxQ==$0 TABLE
BIN$8++Yu/zd6sLgQAB/AQBXxQ==$0 TABLE
BIN$8++Yu/ze6sLgQAB/AQBXxQ==$0 TABLE
BIN$8++Yu/zi6sLgQAB/AQBXxQ==$0 TABLE
TEST TABLE
11 rows selected.
SQL> conn scott/oracle
Connected.
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
DEPT TABLE
EMP TABLE
BONUS TABLE
SALGRADE TABLE
TEST TABLE
EXPFULL TABLE
6 rows selected.
测试:
[oracle@linux5 imp_exp]$ exp system/oracle owner=scott,test file=/u01/imp_exp/scott_test.dmp log=/u01/imp_exp/scott_test.log
Export: Release 10.2.0.1.0 - Production on Wed Apr 9 01:00:47 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P1 character set (possible charset conversion)
About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user SCOTT
. exporting foreign function library names for user TEST
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user SCOTT
. exporting object type definitions for user TEST
About to export SCOTT's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export SCOTT's tables via Conventional Path ...
. . exporting table BONUS 0 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table DEPT 4 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table EMP 14 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table EXPFULL 1653 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table SALGRADE 5 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table TEST 5 rows exported
EXP-00091: Exporting questionable statistics.
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
About to export TEST's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export TEST's tables via Conventional Path ...
. . exporting table BONUS 0 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table DEPT 4 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table EMP 14 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table EXPFULL 1653 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table SALGRADE 5 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table TEST 4 rows exported
EXP-00091: Exporting questionable statistics.
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully with warnings.
4.整库导出:必须是拥有DBA角色,或者拥有EXP_FULL_DATABASE角色。
[oracle@linux5 imp_exp]$ exp system/oracle full=y file=/u01/imp_exp/fulldb.dmp log=/u01/imp_exp/fulldb.log
Export: Release 10.2.0.1.0 - Production on Wed Apr 9 01:11:36 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P1 character set (possible charset conversion)
About to export the entire database ...
. exporting tablespace definitions
. exporting profiles
. exporting user definitions
. exporting roles
. exporting resource costs
. exporting rollback segment definitions
. exporting database links
. exporting sequence numbers
. exporting directory aliases
. exporting context namespaces
. exporting foreign function library names
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions
…………………………………………………………
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. exporting posttables actions
. exporting triggers
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting user history table
. exporting default and system auditing options
. exporting statistics
Export terminated successfully with warnings.
5.控制是否导出索引、约束、授权、触发器
[oracle@linux5 imp_exp]$ exp scott file=/u01/imp_exp/scott.dmp log=/u01/imp_exp/scott.log
GRANTS=N INDEXES=N constraints=n triggers=n
Export: Release 10.2.0.1.0 - Production on Wed Apr 9 01:24:26 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Password:
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P1 character set (possible charset conversion)
Note: grants on tables/views/sequences/roles will not be exported
Note: indexes on tables will not be exported
Note: constraints on tables will not be exported
About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user SCOTT
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user SCOTT
About to export SCOTT's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export SCOTT's tables via Conventional Path ...
. . exporting table BONUS 0 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table DEPT 4 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table EMP 14 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table EXPFULL 1653 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table SALGRADE 5 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table TEST 5 rows exported
EXP-00091: Exporting questionable statistics.
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting indextypes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully with warnings.
EXP-00091:客户端执行导出时的语言环境应与服务器端的相同
SQL> select * from v$NLS_PARAMETERS where PARAMETER='NLS_CHARACTERSET';
PARAMETER
----------------------------------------------------------------
VALUE
----------------------------------------------------------------
NLS_CHARACTERSET
WE8ISO8859P1
上面是服务器端的环境变量,接下来设置客户端
[oracle@linux5 ~]$ export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
[oracle@linux5 ~]$ echo $NLS_LANG
AMERICAN_AMERICA.WE8ISO8859P1
背景:
SQL> create table testexp as select * from emp;
Table created.
SQL> select count(*) from testexp;
COUNT(*)
----------
14
[oracle@linux5 ~]$ exp scott/oracle tables=testexp query=\"where rownum\
Export: Release 10.2.0.1.0 - Production on Wed Apr 9 04:43:13 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in WE8ISO8859P1 character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table TESTEXP 4 rows exported
Export terminated successfully without warnings.
这次没有报EXP-00091,如果还出错就是表的问题。
Import:
导入指定表到其他用户下面:
[oracle@linux5 imp_exp]$ imp test/oracle fromuser=scott touser=test
file=/u01/imp_exp/scott.dmp log=/u01/imp_exp/scott_to_test.log
Import: Release 10.2.0.1.0 - Production on Wed Apr 9 19:31:10 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export file created by EXPORT:V10.02.01 via conventional path
Warning: the objects were exported by SCOTT, not by you
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses WE8ISO8859P1 character set (possible charset conversion)
IMP-00015: following statement failed because the object already exists:
"CREATE TABLE "BONUS" ("ENAME" VARCHAR2(10), "JOB" VARCHAR2(9), "SAL" NUMBER"
", "COMM" NUMBER) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INI"
"TIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) "
" LOGGING NOCOMPRESS"
IMP-00015: following statement failed because the object already exists:
"CREATE TABLE "DEPT" ("DEPTNO" NUMBER(2, 0), "DNAME" VARCHAR2(14), "LOC" VAR"
"CHAR2(13)) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 6"
"5536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) "
"LOGGING NOCOMPRESS"
IMP-00015: following statement failed because the object already exists:
"CREATE TABLE "EMP" ("EMPNO" NUMBER(4, 0), "ENAME" VARCHAR2(10), "JOB" VARCH"
"AR2(9), "MGR" NUMBER(4, 0), "HIREDATE" DATE, "SAL" NUMBER(7, 2), "COMM" NUM"
"BER(7, 2), "DEPTNO" NUMBER(2, 0)) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRAN"
"S 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAU"
"LT) LOGGING NOCOMPRESS"
IMP-00015: following statement failed because the object already exists:
"CREATE TABLE "EXPFULL" ("PROCESS_ORDER" NUMBER, "DUPLICATE" NUMBER, "DUMP_F"
"ILEID" NUMBER, "DUMP_POSITION" NUMBER, "DUMP_LENGTH" NUMBER, "DUMP_ALLOCATI"
"ON" NUMBER, "COMPLETED_ROWS" NUMBER, "ERROR_COUNT" NUMBER, "ELAPSED_TIME" N"
"UMBER, "OBJECT_TYPE_PATH" VARCHAR2(200), "OBJECT_PATH_SEQNO" NUMBER, "OBJEC"
"T_TYPE" VARCHAR2(30), "IN_PROGRESS" CHAR(1), "OBJECT_NAME" VARCHAR2(500), ""
"OBJECT_LONG_NAME" VARCHAR2(4000), "OBJECT_SCHEMA" VARCHAR2(30), "ORIGINAL_O"
"BJECT_SCHEMA" VARCHAR2(30), "PARTITION_NAME" VARCHAR2(30), "SUBPARTITION_NA"
"ME" VARCHAR2(30), "FLAGS" NUMBER, "PROPERTY" NUMBER, "COMPLETION_TIME" DATE"
", "OBJECT_TABLESPACE" VARCHAR2(30), "SIZE_ESTIMATE" NUMBER, "OBJECT_ROW" NU"
"MBER, "PROCESSING_STATE" CHAR(1), "PROCESSING_STATUS" CHAR(1), "BASE_PROCES"
"S_ORDER" NUMBER, "BASE_OBJECT_TYPE" VARCHAR2(30), "BASE_OBJECT_NAME" VARCHA"
"R2(30), "BASE_OBJECT_SCHEMA" VARCHAR2(30), "ANCESTOR_PROCESS_ORDER" NUMBER,"
" "DOMAIN_PROCESS_ORDER" NUMBER, "PARALLELIZATION" NUMBER, "UNLOAD_METHOD" N"
"UMBER, "GRANULES" NUMBER, "SCN" NUMBER, "GRANTOR" VARCHAR2(30), "XML_CLOB" "
"CLOB, "NAME" VARCHAR2(30), "VALUE_T" VARCHAR2(4000), "VALUE_N" NUMBER, "IS_"
"DEFAULT" NUMBER, "FILE_TYPE" NUMBER, "USER_DIRECTORY" VARCHAR2(4000), "USER"
"_FILE_NAME" VARCHAR2(4000), "FILE_NAME" VARCHAR2(4000), "EXTEND_SIZE" NUMBE"
"R, "FILE_MAX_SIZE" NUMBER, "PROCESS_NAME" VARCHAR2(30), "LAST_UPDATE" DATE,"
" "WORK_ITEM" VARCHAR2(30), "OBJECT_NUMBER" NUMBER, "COMPLETED_BYTES" NUMBER"
", "TOTAL_BYTES" NUMBER, "METADATA_IO" NUMBER, "DATA_IO" NUMBER, "CUMULATIVE"
"_TIME" NUMBER, "PACKET_NUMBER" NUMBER, "OLD_VALUE" VARCHAR2(4000), "SEED" N"
"UMBER, "LAST_FILE" NUMBER, "USER_NAME" VARCHAR2(30), "OPERATION" VARCHAR2(3"
"0), "JOB_MODE" VARCHAR2(30), "CONTROL_QUEUE" VARCHAR2(30), "STATUS_QUEUE" V"
"ARCHAR2(30), "REMOTE_LINK" VARCHAR2(4000), "VERSION" NUMBER, "DB_VERSION" V"
"ARCHAR2(30), "TIMEZONE" VARCHAR2(64), "STATE" VARCHAR2(30), "PHASE" NUMBER,"
" "GUID" RAW(16), "START_TIME" DATE, "BLOCK_SIZE" NUMBER, "METADATA_BUFFER_S"
"IZE" NUMBER, "DATA_BUFFER_SIZE" NUMBER, "DEGREE" NUMBER, "PLATFORM" VARCHAR"
"2(101), "ABORT_STEP" NUMBER, "INSTANCE" VARCHAR2(60)) PCTFREE 10 PCTUSED 4"
"0 INITRANS 10 MAXTRANS 255 STORAGE(INITIAL 393216 FREELISTS 1 FREELIST GROU"
"PS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS LOB ("XML_C"
"LOB") STORE AS (TABLESPACE "USERS" ENABLE STORAGE IN ROW CHUNK 8192 PCTVER"
"SION 10 NOCACHE LOGGING STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS "
"1 BUFFER_POOL DEFAULT))"
IMP-00015: following statement failed because the object already exists:
"CREATE TABLE "SALGRADE" ("GRADE" NUMBER, "LOSAL" NUMBER, "HISAL" NUMBER) P"
"CTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELIST"
"S 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) LOGGING NOCOM"
"PRESS"
IMP-00015: following statement failed because the object already exists:
"CREATE TABLE "TEST" ("ID" NUMBER(*,0)) PCTFREE 10 PCTUSED 40 INITRANS 1 MA"
"XTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL "
"DEFAULT) LOGGING NOCOMPRESS"
Import terminated successfully with warnings.
导入表结构到指定用户:
修改test用户的默认表空间为test:
SQL> create user test identified by oracle;
User created.
SQL> select username,default_tablespace from user_users;
USERNAME DEFAULT_TABLESPACE
------------------------------ ------------------------------
TEST USERS(默认情况)
SQL> grant dba to test;
Grant succeeded.
SQL> create tablespace test
2 datafile '/u01/app/oracle/oradata/orcl/tests.dbf'
3 size 50m;
Tablespace created.
SQL> alter user test default tablespace test
2 ;
User altered.
SQL> select username,default_tablespace from user_users;
USERNAME DEFAULT_TABLESPACE
------------------------------ ------------------------------
TEST TEST
测试:
[oracle@linux5 orcl]$ export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
[oracle@linux5 orcl]$ echo $NLS_LANG
AMERICAN_AMERICA.WE8ISO8859P1
[oracle@linux5 orcl]$ exp scott/oracle tables=dept,emp file=/u01/imp_exp/dept_emp.dmp log=/u01/imp_exp/dept_emp.log
Export: Release 10.2.0.1.0 - Production on Thu Apr 10 18:14:00 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in WE8ISO8859P1 character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table DEPT 4 rows exported
. . exporting table EMP 14 rows exported
Export terminated successfully without warnings.
导入:
[oracle@linux5 orcl]$ imp test/oracle fromuser=scott touser=test file=/u01/imp_exp/dept_emp.dmp log=/u01/imp_exp/scott_to_test.log
Import: Release 10.2.0.1.0 - Production on Thu Apr 10 18:14:44 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export file created by EXPORT:V10.02.01 via conventional path
Warning: the objects were exported by SCOTT, not by you
import done in WE8ISO8859P1 character set and AL16UTF16 NCHAR character set
. importing SCOTT's objects into TEST
. . importing table "DEPT" 4 rows imported
. . importing table "EMP" 14 rows imported
About to enable constraints...
Import terminated successfully without warnings.
10g用户的默认表空间是USERS表空间:
SQL> select username,default_tablespace from user_users;
USERNAME DEFAULT_TABLESPACE
------------------------------ ------------------------------
TEST TEST
SQL> select table_name,tablespace_name from user_tables;
TABLE_NAME TABLESPACE_NAME
------------------------------ ------------------------------
EMP USERS
DEPT USERS
SQL> conn scott/oracle
Connected.
SQL> select table_name,tablespace_name from user_tables where table_name in ('emp','dept');
no rows selected
SQL> select table_name,tablespace_name from user_tables where table_name in ('EMP','DEPT');
TABLE_NAME TABLESPACE_NAME
------------------------------ ------------------------------
DEPT USERS
EMP USERS
解决:
删除之前的导入数据,显示授权用户指定表空间的存储权限,并回收Unlimited Tablespace权限:
例如:授予Test用户无限操作Test表空间权限,并收回UT权限:
SQL> conn test/oracle
Connected.
SQL> drop table emp purge;
Table dropped.
SQL> drop table dept purge;
Table dropped.
SQL> select * from tab;
no rows selected
SQL> conn / as sysdba
Connected.
SQL> alter user test quota unlimited on test;
User altered.
SQL> revoke unlimited tablespace from test;
Revoke succeeded.
[oracle@linux5 orcl]$ imp test/oracle fromuser=scott touser=test file=/u01/imp_exp/dept_emp.dmp log=/u01/imp_exp/scott_to_test.log
Import: Release 10.2.0.1.0 - Production on Thu Apr 10 18:25:24 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export file created by EXPORT:V10.02.01 via conventional path
Warning: the objects were exported by SCOTT, not by you
import done in WE8ISO8859P1 character set and AL16UTF16 NCHAR character set
. importing SCOTT's objects into TEST
. . importing table "DEPT" 4 rows imported
. . importing table "EMP" 14 rows imported
About to enable constraints...
Import terminated successfully without warnings.
SQL> conn test/oracle
Connected.
SQL> select table_name,tablespace_name from user_tables where table_name in ('EMP','DEPT');
TABLE_NAME TABLESPACE_NAME
------------------------------ ------------------------------
DEPT TEST
EMP TEST
导入表结构到指定用户:
删除之后重新导入
[oracle@linux5 orcl]$ imp test/oracle fromuser=scott touser=test file=/u01/imp_exp/dept_emp.dmp log=/u01/imp_exp/scott_to_test.log
rows=n
Import: Release 10.2.0.1.0 - Production on Thu Apr 10 18:31:01 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export file created by EXPORT:V10.02.01 via conventional path
Warning: the objects were exported by SCOTT, not by you
import done in WE8ISO8859P1 character set and AL16UTF16 NCHAR character set
. importing SCOTT's objects into TEST
About to enable constraints...
Import terminated successfully without warnings.
SQL> conn test/oracle
Connected.
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
DEPT TABLE
EMP TABLE
SQL> select * from emp;
no rows selected
果真只有表结构,没有数据……

데이터베이스 및 프로그래밍에서 MySQL의 위치는 매우 중요합니다. 다양한 응용 프로그램 시나리오에서 널리 사용되는 오픈 소스 관계형 데이터베이스 관리 시스템입니다. 1) MySQL은 웹, 모바일 및 엔터프라이즈 레벨 시스템을 지원하는 효율적인 데이터 저장, 조직 및 검색 기능을 제공합니다. 2) 클라이언트 서버 아키텍처를 사용하고 여러 스토리지 엔진 및 인덱스 최적화를 지원합니다. 3) 기본 사용에는 테이블 작성 및 데이터 삽입이 포함되며 고급 사용에는 다중 테이블 조인 및 복잡한 쿼리가 포함됩니다. 4) SQL 구문 오류 및 성능 문제와 같은 자주 묻는 질문은 설명 명령 및 느린 쿼리 로그를 통해 디버깅 할 수 있습니다. 5) 성능 최적화 방법에는 인덱스의 합리적인 사용, 최적화 된 쿼리 및 캐시 사용이 포함됩니다. 모범 사례에는 거래 사용 및 준비된 체계가 포함됩니다

MySQL은 소규모 및 대기업에 적합합니다. 1) 소기업은 고객 정보 저장과 같은 기본 데이터 관리에 MySQL을 사용할 수 있습니다. 2) 대기업은 MySQL을 사용하여 대규모 데이터 및 복잡한 비즈니스 로직을 처리하여 쿼리 성능 및 트랜잭션 처리를 최적화 할 수 있습니다.

InnoDB는 팬텀 읽기를 차세대 점화 메커니즘을 통해 효과적으로 방지합니다. 1) Next-Keylocking은 Row Lock과 Gap Lock을 결합하여 레코드와 간격을 잠그기 위해 새로운 레코드가 삽입되지 않도록합니다. 2) 실제 응용 분야에서 쿼리를 최적화하고 격리 수준을 조정함으로써 잠금 경쟁을 줄이고 동시성 성능을 향상시킬 수 있습니다.

MySQL은 프로그래밍 언어가 아니지만 쿼리 언어 SQL은 프로그래밍 언어의 특성을 가지고 있습니다. 1. SQL은 조건부 판단, 루프 및 가변 작업을 지원합니다. 2. 저장된 절차, 트리거 및 기능을 통해 사용자는 데이터베이스에서 복잡한 논리 작업을 수행 할 수 있습니다.

MySQL은 오픈 소스 관계형 데이터베이스 관리 시스템으로, 주로 데이터를 신속하고 안정적으로 저장하고 검색하는 데 사용됩니다. 작업 원칙에는 클라이언트 요청, 쿼리 해상도, 쿼리 실행 및 반환 결과가 포함됩니다. 사용의 예로는 테이블 작성, 데이터 삽입 및 쿼리 및 조인 작업과 같은 고급 기능이 포함됩니다. 일반적인 오류에는 SQL 구문, 데이터 유형 및 권한이 포함되며 최적화 제안에는 인덱스 사용, 최적화 된 쿼리 및 테이블 분할이 포함됩니다.

MySQL은 데이터 저장, 관리, 쿼리 및 보안에 적합한 오픈 소스 관계형 데이터베이스 관리 시스템입니다. 1. 다양한 운영 체제를 지원하며 웹 응용 프로그램 및 기타 필드에서 널리 사용됩니다. 2. 클라이언트-서버 아키텍처 및 다양한 스토리지 엔진을 통해 MySQL은 데이터를 효율적으로 처리합니다. 3. 기본 사용에는 데이터베이스 및 테이블 작성, 데이터 삽입, 쿼리 및 업데이트가 포함됩니다. 4. 고급 사용에는 복잡한 쿼리 및 저장 프로 시저가 포함됩니다. 5. 설명 진술을 통해 일반적인 오류를 디버깅 할 수 있습니다. 6. 성능 최적화에는 인덱스의 합리적인 사용 및 최적화 된 쿼리 문이 포함됩니다.

MySQL은 성능, 신뢰성, 사용 편의성 및 커뮤니티 지원을 위해 선택됩니다. 1.MYSQL은 효율적인 데이터 저장 및 검색 기능을 제공하여 여러 데이터 유형 및 고급 쿼리 작업을 지원합니다. 2. 고객-서버 아키텍처 및 다중 스토리지 엔진을 채택하여 트랜잭션 및 쿼리 최적화를 지원합니다. 3. 사용하기 쉽고 다양한 운영 체제 및 프로그래밍 언어를 지원합니다. 4. 강력한 지역 사회 지원을 받고 풍부한 자원과 솔루션을 제공합니다.

InnoDB의 잠금 장치에는 공유 잠금 장치, 독점 잠금, 의도 잠금 장치, 레코드 잠금, 갭 잠금 및 다음 키 잠금 장치가 포함됩니다. 1. 공유 잠금을 사용하면 다른 트랜잭션을 읽지 않고 트랜잭션이 데이터를 읽을 수 있습니다. 2. 독점 잠금은 다른 트랜잭션이 데이터를 읽고 수정하는 것을 방지합니다. 3. 의도 잠금은 잠금 효율을 최적화합니다. 4. 레코드 잠금 잠금 인덱스 레코드. 5. 갭 잠금 잠금 장치 색인 기록 간격. 6. 다음 키 잠금은 데이터 일관성을 보장하기 위해 레코드 잠금과 갭 잠금의 조합입니다.


핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

mPDF
mPDF는 UTF-8로 인코딩된 HTML에서 PDF 파일을 생성할 수 있는 PHP 라이브러리입니다. 원저자인 Ian Back은 자신의 웹 사이트에서 "즉시" PDF 파일을 출력하고 다양한 언어를 처리하기 위해 mPDF를 작성했습니다. HTML2FPDF와 같은 원본 스크립트보다 유니코드 글꼴을 사용할 때 속도가 느리고 더 큰 파일을 생성하지만 CSS 스타일 등을 지원하고 많은 개선 사항이 있습니다. RTL(아랍어, 히브리어), CJK(중국어, 일본어, 한국어)를 포함한 거의 모든 언어를 지원합니다. 중첩된 블록 수준 요소(예: P, DIV)를 지원합니다.

SecList
SecLists는 최고의 보안 테스터의 동반자입니다. 보안 평가 시 자주 사용되는 다양한 유형의 목록을 한 곳에 모아 놓은 것입니다. SecLists는 보안 테스터에게 필요할 수 있는 모든 목록을 편리하게 제공하여 보안 테스트를 더욱 효율적이고 생산적으로 만드는 데 도움이 됩니다. 목록 유형에는 사용자 이름, 비밀번호, URL, 퍼징 페이로드, 민감한 데이터 패턴, 웹 셸 등이 포함됩니다. 테스터는 이 저장소를 새로운 테스트 시스템으로 간단히 가져올 수 있으며 필요한 모든 유형의 목록에 액세스할 수 있습니다.

에디트플러스 중국어 크랙 버전
작은 크기, 구문 강조, 코드 프롬프트 기능을 지원하지 않음

SublimeText3 Linux 새 버전
SublimeText3 Linux 최신 버전

Dreamweaver Mac版
시각적 웹 개발 도구
