各种flashback与各种log 的关系
从9i开始oracle提供了一个很强大的flashback,10G更是对闪回做了加强,闪加数据变的更加简单,各种闪回又是如何实现呢的?是redo log?undo log?flashback log?recyclebin?
Flashback Table, Flashback Query, Flashback Transaction Query and Flashback Version
Query all rely on undo data, records of the effects of each update to an Oracle database
and values overwritten in the update…..
64位linux安装ORACLE10G报i386/libawt.so: libXp.so.6: cannot open shared object file
昨天在给一台新机器装oracle,系统是centos 5.2 x64,数据库 库是oracle 10g x64,按装官方文档把包也检查了一下,但在.runrunInstaller时,报错Exception in thread “main” java.lang.UnsatisfiedLinkError: /tmp/OraInstall2007-12-21_10-40-21PM/jre/lib/i386/libawt.so: libXp.so.6: cannot open shared object file
列类型指定int 与number有什么区别
int和number都是数值类型,int是正整数,number可以允许小数位,number重点在这里不多讲,只是说在不指定参数的情况下有什么区别?
还是老风格,用实例说话
oracle 排除(exclude)字段查询表
如果一张表有30个字段,40个,100个…,反正就是不小字段时,如果你查询部分字段数据,是不是要一个个字段名都写上,有没有一种指明排除几个字段查询呢?今天看有人问这个问题,随便做一下。
SQL>CONN anbob/anbob
SQL> create table test_cols(id int);
truncate 会记录日志么?logmnr可以找到么?
如果有人truncate了你的表,你能揪出是谁么?会记录redo日志么?下现做一个实验,用事实说话
SQL> select * from v$version;
BANNER
——————————————————————————————————————————–
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Prod
ORACLE resumable session功能
Oracle还为我们提供了一个很好的功能:resumable
在resumable开启的情况下,如果Oracle执行某一个SQL申请不到空间了,会停顿下来(时间可以由TIMEOUT来控制),但是不会报OUT-OF-SPACE这个错误。等你把空间的问题解决了,Oracle会继续从停下来的部分开始刚才的SQL。
DB_nk_CACHE_SIZE中的granule
….
这里涉及到了SGA中内存分配的粒度问题,粒度是连续虚拟内存分配的单位,在9I版本引入了一个粒度(granule)的概念,如果SGA小于128M,则粒组大小为4M,否则为16M;在10G版本中,如果SGA小于1G,则粒组为4M,否则大于4M。粒度大小受内部隐含参数_ksmg_granule_size的控制
…….
linux 命令从redo日志中找sql
用linux的命令是可以读出redo日志的
[oracle@orazhang windb]$ strings redo1.log |sed -n ‘/create procedure/,/end;/p’
create procedure ptest
begin
dbms_output.put_line(‘nothing’);
end;
copy 数据文件数据库移植从windows到linux
今天闲来无事,做了个极其无聊的实验,把windows上的orcl数据库的数据文件(dbf)复制到linux上会不会也能用呢?我觉的工作中除了测试没人这么搞,下面把步骤分享一下,今天试了一天,一步错步步错呀!
pc1:winxp 32bit oracle10.2.0.1 dbname:orcl
pc2:rehl 5 linux 32bit oracle 10.2.0.1 dbname:orcl
oracle 10g logminer笔记(三)
logminer实战篇
1,session 1 ,建立几个对象,并做更新
2,session 2, 进行logmnr分析
3, session 3,等session2分析出来后,能不能查看他的结果?
4,先不启用supplemental log,进行分析
5, 用其中两种数据字典分析online data dictionary、flat file dictionary
6, 启用supplemental log,进行分析
oracle 10g logminer笔记(二)
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
启动 最小附加日志才可以LOGMNR中看到DML,在做DG中也会提到这个设置,这个参数在ORACLE 9I的9.1版本是个界限,以前默认打开,新版本默认关闭。但SUPPLEMENTAL LOG会给系统带来什么影响呢?redo 增长速度会加快么?会
oracle 10g logminer笔记(一)
对于搞ORACLE数据库的人来说,LOGMINER这个装备已并不陌生,从oracle 8i开始官方公开了LOGMINER工具,可以分析REDO日志文件包括在线或已归档,因为知道数据库的操作都记录在REDO日志中,logminer和tkprof 一样,不过tkprof是分析TRACE文件,logminer是分析redo log.
…
What is backup retention policy?
The Recovery Manager (RMAN) provides the CONFIGURE RETENTION POLICY command to create a persistent and automatic backup retention policy for controlling how long backups and copies should be retained. When a backup retention policy is in effect, RMAN considers the backups and copies of data files and control files as obsolete…
delete obsolete和delete expired区别
delete exipired
If you run CROSSCHECK, and if RMAN cannot locate the files, then it updates their records in the RMAN repository to EXPIRED status. You can then use the DELETE EXPIRED command to remove records of expired backups and copies from the RMAN repository.
…
一种select产生redo的情况
SQL> select count(*) from zwz.testredo;
COUNT(*)
———-
52840
Execution Plan
———————————————————-
Plan hash value: 1457698251
———————————————————————–
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
———————————————————————–
| 0 | SELECT STATEMENT | | 1 | 158 (1)| 00:00:02 |
| 1 | SORT AGGREGATE | | 1 | | |
| 2 | TABLE ACCESS FULL| TESTREDO | 68430 | 158 (1)| 00:00:02 |
———————————————————————–
Note
—–
– dynamic sampling used for this statement
Statistics
———————————————————-
0 recursive calls
0 db block gets
12787 consistent gets
0 physical reads
4780 redo size
How to add primary key on existing data of table(ORA-02437)(给已存在数据表增加主键)
SQL> alter table testcons add constraint pk_id primary key(id) enable novalidate;
alter table testcons add constraint pk_id primary key(id) enable novalidate
*
ERROR at line 1:
ORA-02437: cannot validate (ANBOB.PK_ID) – primary key violated
一个面试题
起始地 目的地 距离(公里)
A B 1000
A C 1100
A D 900
A E 400
B D 300
F G 1000
C B 600
请用SQL语句或一段代码写出从A出发,可达到的目的地(包括间接方式)。
procedure中truncate other schema’s table
SQL> create or replace procedure p_trun_t2
2 is
3 v_sql varchar2(1000);
4 begin
5 v_sql := ‘truncate table test2.t2’;
6 execute immediate v_sql;
7 end;
8 /
Procedure created.
procedure调用DDL需显示授权
存储过程中执行DDL与DML有很大的区别,比如你在存储过程中创建表,虽然你授于了建表的角色给它,即便是DBA,在调用时也是会提示ORA-01031: insufficient privileges,显然是权限问题,记住如果在存储过程中调用DDL要显示授权,通过ROLE传授的权限是被忽略的。下面做一个实验证明
SQL> conn test/test
未知导出(exp)用户的DMP文件导入(imp)方法及EXP-00091异常原因
[oracle@orazhang ~]$ exp test/test file=test.dbf
Export: Release 10.2.0.1.0 – Production on 星期三 4月 13 17:19:24 2011
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 ZHS16GBK character set and AL16UTF16 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion)
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user TEST