Oracle 11g R2明确声明不再支持export和import淘汰的原因:导入导出速度慢替代品:数据泵,速度提升5倍,但是不能远程导入导出,
Oracle 11g R2明确声明不再支持export和import
淘汰的原因:导入导出速度慢
替代品:数据泵,速度提升5倍,但是不能远程导入导出,只能在服务端
数据泵工具expdp和impdp
exp工具导出数据库文件成.DMP后缀的二进制文件
.dmp文件平台无关性
exp导出前
1.运行catexp.sql或者catalog.sql脚本(只要求手工创建实例,用dbca创建的数据库实例不需要)
2.确保有充足的磁盘空间
3.确认有所需的权限:导本用户需要create session权限,导其他用户需要EXP_FULL_DATABASE角色
exp xxwz/xxwz@XXWZ file=xxwz.dmp owner=xxwz log=xxwz.log
调用方式
命令行方式
交互式方式
参数文件方式
OEM
命令行方式:
导出模式:
表模式:
exp hr/hr tables=employees,departments,%A%,emp:emp1 rows=yes file=exp1.dmp //%A%通配符,导出所有含A的表;emp:emp1导出分区表emp的分区emp.
用户模式:
exp sys/sys owner=hr direct=y file=expdat.dmp//用直接模式导出hr用户的数据
表空间模式:
exp \'sys/sys as sysdba\' transport_tablespace=y tablespaces=xxwz_data log=xxwz.log
//导出xxwz表空间的数据字典信息,不导数据
全数据库模式
exp sys/sys FULL=y file=d:\xxwz.dmp grants=y rows=y //GRANTS为导出权限,rows为导出数据
交互式
exp hr/hr
参数文件方式
写一个参数文件exp.txt
file=xxwz.dmp
log=xxwz.log
owner=xxwz
rows=y
然后执行exp命令
exp xxwz/xxwz@XXWZ parfile=d:\exp.txt
导入导出字符集转换
源数据库与exp字符集转换、exp字符集与imp字符集转换、imp字符集与目标数据库字符集转换
如果事先设置好这么字符集就可以避免转换
查看数据库字符集信息
select * from nls_database_parameters;
查询到的参数组合成字符集:NLS_LANGUAGE.NLS_TERRITORY.NLS_CHARACTERSET
查看exp和imp的字符集可以查看注册表的本地机器-软件-oracle-nls_lang或者cmd>chcp再查询代码对应的字符集。
设置exp和imp的字符集
cmd>set NLS_LANG=American_America.AL32UTF8
查看dmp文件的字符集
它的第二字节和第三字节为字符集
或者
imp xxwz/xxwz@XXWZ show=y file=d:\xxwz.dmp //不导入只是看看
导出方式:常规路径模式和直接路径模式(避开检查,,速度提高一倍)
特点:
直接模式不能交互式
客户端和服务端字符集设置一样(不设置一样会有warning)
buffer参数没作用。
命令格式:在命令行加上 direct=y
imp命令
imp sys/sys file=d:\xxwz.dmp fromuser=xxwz touser=xxwz1 table=*;
导入数据顺序
创建表
导入数据
创建B树索引
导入触发器
完整性约束
bitmap、函数、domain索引

ACID attributes include atomicity, consistency, isolation and durability, and are the cornerstone of database design. 1. Atomicity ensures that the transaction is either completely successful or completely failed. 2. Consistency ensures that the database remains consistent before and after a transaction. 3. Isolation ensures that transactions do not interfere with each other. 4. Persistence ensures that data is permanently saved after transaction submission.

MySQL is not only a database management system (DBMS) but also closely related to programming languages. 1) As a DBMS, MySQL is used to store, organize and retrieve data, and optimizing indexes can improve query performance. 2) Combining SQL with programming languages, embedded in Python, using ORM tools such as SQLAlchemy can simplify operations. 3) Performance optimization includes indexing, querying, caching, library and table division and transaction management.

MySQL uses SQL commands to manage data. 1. Basic commands include SELECT, INSERT, UPDATE and DELETE. 2. Advanced usage involves JOIN, subquery and aggregate functions. 3. Common errors include syntax, logic and performance issues. 4. Optimization tips include using indexes, avoiding SELECT* and using LIMIT.

MySQL is an efficient relational database management system suitable for storing and managing data. Its advantages include high-performance queries, flexible transaction processing and rich data types. In practical applications, MySQL is often used in e-commerce platforms, social networks and content management systems, but attention should be paid to performance optimization, data security and scalability.

The relationship between SQL and MySQL is the relationship between standard languages and specific implementations. 1.SQL is a standard language used to manage and operate relational databases, allowing data addition, deletion, modification and query. 2.MySQL is a specific database management system that uses SQL as its operating language and provides efficient data storage and management.

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

Key metrics for EXPLAIN commands include type, key, rows, and Extra. 1) The type reflects the access type of the query. The higher the value, the higher the efficiency, such as const is better than ALL. 2) The key displays the index used, and NULL indicates no index. 3) rows estimates the number of scanned rows, affecting query performance. 4) Extra provides additional information, such as Usingfilesort prompts that it needs to be optimized.

Usingtemporary indicates that the need to create temporary tables in MySQL queries, which are commonly found in ORDERBY using DISTINCT, GROUPBY, or non-indexed columns. You can avoid the occurrence of indexes and rewrite queries and improve query performance. Specifically, when Usingtemporary appears in EXPLAIN output, it means that MySQL needs to create temporary tables to handle queries. This usually occurs when: 1) deduplication or grouping when using DISTINCT or GROUPBY; 2) sort when ORDERBY contains non-index columns; 3) use complex subquery or join operations. Optimization methods include: 1) ORDERBY and GROUPB


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 English version
Recommended: Win version, supports code prompts!

Notepad++7.3.1
Easy-to-use and free code editor