日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

导出oracle sequences,利用数据泵只导出序列

發布時間:2023/12/10 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 导出oracle sequences,利用数据泵只导出序列 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Oracle的數據泵導入導出功能比原有的導入導出工具(exp/imp)功能強很多。

利用數據泵我們可以只導出某一特定對象類型,并且可以指定過濾條件。這個功能的實現主要依靠expdp的include參數。聯機文檔對于參數的功能描述如下:

INCLUDE

Default: none

Purpose

Enables you to filter the metadata that is exported by specifying objects and object

types for the current export mode. The specified objects and all their dependent objectsare exported. Grants on these objects are also exported.

Syntax and Description

INCLUDE = object_type[:name_clause] [, ...]

Only object types explicitly specified in INCLUDE statements, and their dependent objects, are exported. No other object types, including the schema definition information that is normally part of a schema-mode export when you have the EXP_FULL_DATABASE role, are exported.

To see a list of valid object type path names for use with the INCLUDE parameter, youcan query the following views: DATABASE_EXPORT_OBJECTS, SCHEMA_EXPORT_OBJECTS, and TABLE_EXPORT_OBJECTS.

The name_clause is optional. It allows fine-grained selection of specific objects within an object type. It is a SQL expression used as a filter on the object names of the type. It consists of a SQL operator and the values against which the object names of the specified type are to be compared. The name clause applies only to object types whose instances have names (for example, it is applicable to TABLE, but not to GRANT).?? The optional name clause must be separated from the object type with a colon and

enclosed in double quotation marks, because single-quotation marks are required to delimit the name strings.

Oracle recommends that INCLUDE statements be placed in a parameter file; otherwise you might have to use operating system-specific escape characters on the command line before quotation marks. See Use of Quotation Marks On the Data Pump Command Line on page 2-6.

For example, suppose you have a parameter file named hr.par with the following

content:

SCHEMAS=HR

DUMPFILE=expinclude.dmp

DIRECTORY=dpump_dir1

LOGFILE=expinclude.log

INCLUDE=TABLE:"IN ('EMPLOYEES', 'DEPARTMENTS')"

INCLUDE=PROCEDURE

INCLUDE=INDEX:"LIKE 'EMP%'"

You could then use the hr.par file to start an export operation, without having to

enter any other parameters on the command line:

> expdp hr/hr parfile=hr.par

Restrictions

■ The INCLUDE and EXCLUDE parameters are mutually exclusive.

■ Grants on objects owned by the SYS schema are never exported.

Example

The following example performs an export of all tables (and their dependent objects)in the hr schema:

>expdp hr/hr INCLUDE=TABLE DUMPFILE=dpump_dir1:exp_inc.dmp NOLOGFILE=y

SQL> show user

USER 為 "SYS"

SQL> conn admin/admin

已連接。

SQL> select sequence_name from user_sequences;

未選定行

SQL> create sequence s;

序列已創建。

SQL> select s.nextval from dual;

NEXTVAL

----------

1

SQL> select s.nextval from dual;

NEXTVAL

----------

2

SQL> select s.nextval from dual;

NEXTVAL

----------

3

SQL> create sequence s1;

序列已創建。

SQL> create sequence s2;

序列已創建。

SQL> create sequence s3;

序列已創建。

SQL> create sequence s4;

序列已創建。

SQL> create sequence a;

序列已創建。

SQL> create sequence a1;

序列已創建。

SQL> create sequence a2;

序列已創建。

SQL> create sequence a3;

序列已創建。

SQL> select sequence_name from user_sequences;

SEQUENCE_NAME

------------------------------

S

S1

S2

S3

S4

A

A1

A2

A3

已選擇9行。

下面我們只講序列前綴為S的序列導出。

C:\>type parfile.par

userid=admin/admin

dumpfile=test:sequence.dp

logfile=sequence.log

include=sequence:"like 'S%'"

C:\>expdp parfile=parfile.par

Export: Release 10.2.0.1.0 - Production on 星期二, 29 12月, 2009 11:21:18

Copyright (c) 2003, 2005, Oracle.? All rights reserved.

連接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

自動啟用 FLASHBACK 以保持數據庫完整性。

啟動 "ADMIN"."SYS_EXPORT_SCHEMA_01":? parfile=parfile.par

正在使用 BLOCKS 方法進行估計...

處理對象類型 SCHEMA_EXPORT/TABLE/TABLE_DATA

使用 BLOCKS 方法的總估計: 0 KB

處理對象類型 SCHEMA_EXPORT/SEQUENCE/SEQUENCE

已成功加載/卸載了主表 "ADMIN"."SYS_EXPORT_SCHEMA_01"

******************************************************************************

ADMIN.SYS_EXPORT_SCHEMA_01 的轉儲文件集為:

E:\DATAPUMP\SEQUENCE.DP

作業 "ADMIN"."SYS_EXPORT_SCHEMA_01" 已于 11:21:21 成功完成

刪除原有的序列

SQL> drop sequence s;

序列已刪除。

SQL> drop sequence s1;

序列已刪除。

SQL> drop sequence s2;

序列已刪除。

SQL> drop sequence s3;

序列已刪除。

SQL> drop sequence s4;

序列已刪除。

SQL> drop sequence a;

序列已刪除。

SQL> drop sequence a1;

序列已刪除。

SQL> drop sequence a2;

序列已刪除。

SQL> drop sequence a3;

序列已刪除。

SQL> select sequence_name from user_sequences;

未選定行

導入序列

C:\>impdp userid=admin/admin dumpfile=test:sequence.dp include=sequence

Import: Release 10.2.0.1.0 - Production on 星期二, 29 12月, 2009 11:23:17

Copyright (c) 2003, 2005, Oracle.? All rights reserved.

連接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

已成功加載/卸載了主表 "ADMIN"."SYS_IMPORT_FULL_01"

啟動 "ADMIN"."SYS_IMPORT_FULL_01":? userid=admin/******** dumpfile=test:sequence

.dp include=sequence

處理對象類型 SCHEMA_EXPORT/SEQUENCE/SEQUENCE

作業 "ADMIN"."SYS_IMPORT_FULL_01" 已于 11:23:19 成功完成

SQL> select sequence_name from user_sequences;

SEQUENCE_NAME

------------------------------

S

S1

S2

S3

S4

SQL> select s.nextval from dual;

NEXTVAL

----------

21

注意我們的表數據未導出,此時導入表數據會報錯。

C:\>impdp userid=admin/admin dumpfile=test:sequence.dp include=table

Import: Release 10.2.0.1.0 - Production on 星期二, 29 12月, 2009 11:38:01

Copyright (c) 2003, 2005, Oracle.? All rights reserved.

連接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

ORA-39002: 操作無效

ORA-39168: 未找到對象路徑 TABLE。

總結

以上是生活随笔為你收集整理的导出oracle sequences,利用数据泵只导出序列的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。