天道酬勤

Oracle and My Life

Archive for May, 2010

新手拍微距

2 comments

前段时间入手了Nikon D90,主要是用来记录果果的成长的,由于从来没有玩过单反,真的是七窍通了六窍啊,惭愧之至。抓紧时间在他/她出生前练练手,不然我这个老爸也太逊了^-^。来张在楼下试拍的微距以资鼓励:
flower
-The End-

Written by ochef

May 19th, 2010 at 12:39 pm

Posted in Life

Tagged with

expdp的network_link参数

leave a comment

expdp是server端工具,但可以通过NETWORK_LINK参数实现远端导出,但是前提是远端也安装有Oracle数据库,只有CLIENT端是没有办法利用数据泵的。

这里要指出的是:network_link不支持远端导出分区表中的某一个分区,但可以导整个分区表。以下为测试过程:

创建分区表sales:

[oracle@ora10g ~]$ sqlplus ‘/as sysdba’

SQL> CREATE TABLE sales

(sale_date DATE NOT NULL)

PARTITION BY RANGE (sale_date)

(PARTITION sales2010_q1

VALUES LESS THAN (TO_DATE(’2010-04-01′,’YYYY-MM-DD’))

TABLESPACE sp1,

PARTITION sales2010_q2

VALUES LESS THAN (TO_DATE(’2010-07-01′,’YYYY-MM-DD’))

TABLESPACE sp2,

PARTITION sales2010_q3

VALUES LESS THAN (TO_DATE(’2010-10-01′,’YYYY-MM-DD’))

TABLESPACE sp3);

插入4条记录:

SQL> select count(*) from sales;

COUNT(*)

———-

4

SQL> select * from sales partition(sales2010_q1);

SALE_DATE

————

23-MAR-10

SQL> select * from sales partition(sales2010_q2);

SALE_DATE

————

23-JUN-10

22-JUN-10

SQL> select * from sales partition(sales2010_q3);

SALE_DATE

————

23-SEP-10

远端机器上创建 directory目录、赋权、创建dblink:

[oracle@node1 /]$ sqlplus ‘/as sysdba’

SQL> create directory dump_dir as ‘/backup’;

Directory created.

SQL> grant read,write on directory dump_dir to ochef;

Grant succeeded.

SQL> create database link test connect to ochef identified by oracle using ‘primary’;

Database link created.

SQL> select count(*) from ochef.sales@test;

COUNT(*)

———-

4

远程导出整个分区表:

[oracle@node1 ~]$ expdp ochef/oracle directory=dump_dir dumpfile=sales.dmp network_link=test tables=sales

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – Production

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options

Starting “OCHEF”.”SYS_EXPORT_TABLE_01″:  ochef/******** directory=dump_dir dumpfile=sales.dmp network_link=test tables=sales

Estimate in progress using BLOCKS method…

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 384 KB

Processing object type TABLE_EXPORT/TABLE/TABLE

. . exported “OCHEF”.”SALES”                             4.960 KB       4 rows

Master table “OCHEF”.”SYS_EXPORT_TABLE_01″ successfully loaded/unloaded

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

Dump file set for OCHEF.SYS_EXPORT_TABLE_01 is:

/backup/sales.dmp

Job “OCHEF”.”SYS_EXPORT_TABLE_01″ successfully completed at 11:12:43

远程导出分区表的某个分区:

[oracle@node1 ~]$ expdp ochef/oracle directory=dump_dir dumpfile=sales.dmp network_link=test tables=sales:sales2010_q2

ORA-39001: invalid argument value

ORA-39203: Partition selection is not supported over a network link.

本地导出分区表的某个分区:

[oracle@ora10g ~]$ expdp ochef/oracle directory=dump_dir dumpfile=sales.dmp tables=sales:sales2010_q2

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Starting “OCHEF”.”SYS_EXPORT_TABLE_01″:  ochef/******** directory=dump_dir dumpfile=sales.dmp tables=sales:sales2010_q2

Estimate in progress using BLOCKS method…

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 128 KB

Processing object type TABLE_EXPORT/TABLE/TABLE

. . exported “OCHEF”.”SALES”:”SALES2010_Q2″              4.937 KB       2 rows

Master table “OCHEF”.”SYS_EXPORT_TABLE_01″ successfully loaded/unloaded

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

Dump file set for OCHEF.SYS_EXPORT_TABLE_01 is:

/backup/sales.dmp

Job “OCHEF”.”SYS_EXPORT_TABLE_01″ successfully completed at 11:07:07

关于远程expdp用户权限问题,请移步这里

-The End-

Written by ochef

May 19th, 2010 at 12:27 pm

Posted in Database

Tagged with ,

db_unique_name与service_name

leave a comment

为了data guard在角色切换时不用事先准备好二个init.ora参数文件,那么就需要配置valid_for参数,类似如下配置(备库):

db_unique_name=ora10gstd

log_archive_dest_1=’location=/u01/app/oracle/oradata/ora10g/archive valid_for=(all_logfiles,all_roles) db_unique_name=ora10gstd’

log_archive_dest_2=’service=standby lgwr async valid_for=(online_logfiles,primary_role)   db_unique_name=ora10g’

db_unique_name在oracle的高可用dataguard的应用中会经常使用,有和db_name不一样的作用,在物理dg中,要求主、从库都有一样的db_name(虽然他们和rac不一样,并不是同一个库),但是他们的db_unique_name是不一样的,用以进行不同的标示。

注意:如果修改了db_unique_name的值,会影响到Service_names,也会影响到动态监听的service_name,因此,也应修改tnsnames.ora文件中service_name的服务名,否则,即使tnsping能通,但无法提供相应的服务。

-The End-

Written by ochef

May 19th, 2010 at 9:59 am

Posted in Database

Tagged with ,

无觅相关文章插件,快速提升流量