当前位置:  数据库>oracle
本页文章导读:
    ▪数据库查询      一、字符串连接查询 1、Oracle数据库 SELECT USERID,USERNAME||’:’||USEREMAIL NAMEANDMAIL FROM STUDENT WHERE USERNAME IS NOT NULL AND USERMAIL IS NOT NULL;用CONCAT函数的话,需要注意这个函数只带两个参数,如果有.........
    ▪oralce 用户名密码不区分大小写      oracle 11g 以前的版本的用户名和密码是不区分大小写的; oracle 11g 用户名和密码默认区分大小写,可更改alter system set sec_case_sensitive_logon=false 设置改为不区分大小写。本文链接......
    ▪EXP&EXPDP导出数据同步问题      在itpub论坛上看到一个问题:如果库正在被写,exp是不是导出的数据就是不同步的了? http://www.itpub.net/forum.php?mod=viewthread&tid=1772882&page=1#pid21172716按照推理逻辑,exp导出的数据应该不是同.........

[1]数据库查询
    来源:    发布时间: 2013-10-29

一、字符串连接查询

1、Oracle数据库

SELECT USERID,USERNAME||’:’||USEREMAIL NAMEANDMAIL FROM STUDENT WHERE USERNAME IS NOT NULL AND USERMAIL IS NOT NULL;

用CONCAT函数的话,需要注意这个函数只带两个参数,如果有多个字符串连接的时候就需要多次CONCAT

SELECT CONCAT(‘工号:’,FNUMBER) FORM T_EMPLOYEE;

2、MS SQL server数据库

SELECT AU_ID,AU_FNAME+’ ’+AU_LNAME  ‘NAME’ FROM AUTHORS WHERE STATE=’CA’;

本文链接


    
[2]oralce 用户名密码不区分大小写
    来源:    发布时间: 2013-10-29

oracle 11g 以前的版本的用户名和密码是不区分大小写的;

oracle 11g 用户名和密码默认区分大小写,可更改alter system set sec_case_sensitive_logon=false 设置改为不区分大小写。

本文链接


    
[3]EXP&EXPDP导出数据同步问题
    来源:    发布时间: 2013-10-29

在itpub论坛上看到一个问题:如果库正在被写,exp是不是导出的数据就是不同步的了? http://www.itpub.net/forum.php?mod=viewthread&tid=1772882&page=1#pid21172716

按照推理逻辑,exp导出的数据应该不是同步的,也不可能同步,除非exp能智能判断数据库是否正在写操作,而且一直等到写操作结束为止。显然这些假设都不合理。下面我们来做个实验,验证一下exp导出数据是否同步。

新建一个测试表TEST, 我们写一个循环,往表里面插入1000条记录,而且每插入插入一条记录,停顿0.5秒。这样来模拟数据库处于写状态。

CREATE TABLE TEST
(
ID NUMBER ,
UPDATE_DATE DATE
)


BEGIN

FOR V_INDEX IN 1 .. 1000
LOOP
INSERT INTO TEST
VALUES(V_INDEX, SYSDATE);

COMMIT;

DBMS_LOCK.SLEEP(0.5);

END LOOP;
END;

执行上面脚本,然后我们执行导出表TEST的exp命令,如下所示:


[oracle@DB-Server ~]$ exp userid=etl/***@BIWG tables=test file=test.dmp buffer=4096000 feedback=10000 log=test.log

Export: Release 10.2.0.1.0 - Production on Mon Mar 18 17:48:39 2013

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 ZHS16GBK character set (possible charset conversion)

About to export specified tables via Conventional Path ...
. . exporting table TEST      11 rows exported
Export terminated successfully without warnings.

 


[oracle@DB-Server ~]$ exp userid=etl/***@BIWG tables=test file=test.dmp buffer=4096000 feedback=10000 log=test.log

Export: Release 10.2.0.1.0 - Production on Mon Mar 18 17:48:49 2013

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 ZHS16GBK character set (possible charset conversion)

About to export specified tables via Conventional Path ...
. . exporting table TEST  30 rows exported
Export terminated successfully without warnings.

 


[oracle@DB-Server ~]$ exp userid=etl/***@BIWG tables=test file=test.dmp buffer=4096000 feedback=10000 log=test.log

Export: Release 10.2.0.1.0 - Production on Mon Mar 18 17:48:59 2013

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 ZHS16GBK character set (possible charset conversion)

About to export specified tables via Conventional Path ...
. . exporting table TEST        50 rows exported
Export terminated successfully without warnings.

显然从上面实验来看,可以验证我们的想法:exp导出数据应该是某个时间点的数据,数据是不同步的。

下面我们先截断表TEST的数据,然后重新执行上面SQL脚本,然后来验证一下expdp导出数据是否同步:

[oracle@DB-Server ~]$ expdp userid=etl/***@BIWG directory=DUMP_DIR dumpfile=test1.dmp tables=test logfile=test.log

Export: Release 10.2.0.1.0 - 64bit Production on Monday, 18 March, 2013 18:17:44

Copyright (c) 2003, 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
Starting "ETL"."SYS_EXPORT_TABLE_01": userid=etl/********@BIWG directory=DUMP_DIR dumpfile=test1.dmp tables=test logfile=test.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
. . exported "ETL"."TEST" 8.039 KB        187 rows
Master table "ETL"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for ETL.SYS_EXPORT_TABLE_01 is:
H:\DATAPUMP\TEST1.DMP
Job "ETL"."SYS_EXPORT_TABLE_01" successfully completed at 18:29:40

 

 

[oracle@DB-Server ~]$ expdp userid=etl/***@BIWG directory=DUMP_DIR dumpfile=test2.dmp tables=test logfile=test.log

Export: Release 10.2.0.1.0 - 64bit Production on Monday, 18 March, 2013 18:20:07

Copyright (c) 2003, 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

Starting "ETL"."SYS_EXPOR

    
最新技术文章:
▪current online redo log缺失后的恢复
▪ORA-600 2662错误解决实例
▪ORA-00600 2662错误解决方法
▪Oracle Hidden Parameter:_allow_resetlogs_corruption
▪Oracle诊断事件列表
▪Oracle 隐含参数 _disable_logging 详解
▪ORA-00600 [2662]错误解决过程
▪Oracle里常见的执行计划
▪Oracle里另外一些典型的执行计划
▪Oracle服务器自动备份
▪Oracle固定SQL的执行计划(一)---SQL Profile
▪Oracle固定SQL的执行计划(二)---SPM
▪同一环境下新建Standby RAC库
▪Oracle快速克隆安装
▪Oracle单实例启动多个实例
▪Oracle的PLSQL别名中文出现乱码解决方法
▪ORA-00379: no free buffers available in buffer pool DEFAULT ...
▪RMAN-06023: no backup or copy of datafile 16 found to restor...
▪RMAN还原数据库报错问题解决案例
▪OEL6.8_X86平台部署Oracle 10gR2检测失败问题
▪Oracle 性能优化建议
▪Oracle SQL语句优化心得
▪Oracle慢SQL监控脚本实现
▪Oracle dblink 查询 tns:无法解析指定的连接标识...
▪Red Hat Enterprise Linux 6使用udev配置Oracle ASM总结...
▪Linux6.6及以上版本配置Oracle ASM共享储存-UDEV
▪Oracle 12C 开启数据库归档模式
▪Solairs系统中配置Oracle 12c 开机启动
▪重建DBMS_STATS解决ORA-31626 ORA-21633以及ORA-04063 ORA... iis7站长之家
▪Oracle ASMM 与AMM之间相互切换
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3