11月 13, 2008
By skywalker in DBA |
RMAN具有非常丰富的命令,为这些命令服务的保留字有几十上百个,如allocate、rsync、show、backup等等。
在书写RMAN脚本时,需要特别小心不要用到保留字,否则会导致RMAN-01007错误
以TAG参数为例:
当tag为backup时,报错
RMAN> run{
2> backup tablespace user
3> tag backup
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found “backup”: expecting one of: “double-quoted-string, equal, identifier, single-quoted-string”
RMAN-01007: at line 3 column 5 file: standard input
当tag为backup1时,正常运行
RMAN> run {
2> backup tablespace users
3> tag backup1;
4> }
Starting backup at 13-NOV-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting [...]
email this | tag this | digg this | trackback | comment RSS feed
10月 21, 2008
By skywalker in DBA |
安装
SQL> SQLPLUS / AS SYSDBA
SQL> exec dbms_workload_repository.create_snapshot
SQL> exec:snap_id:=dbms_workload_repository.create_snapshot
SQL> var snap_id number
SQL> print snap_id
SQL> @?/rdbms/admin/awrrpt.sql
操作
1.查看当前的AWR保存策略
select * from dba_hist_wr_control;
DBID,SNAP_INTERVAL,RETENTION,TOPNSQL
860524039,+00 01:00:00.000000,+07 00:00:00.000000,DEFAULT
以上结果表示,每小时产生一个SNAPSHOT,保留7天
2.调整AWR配置
AWR配置都是通过dbms_workload_repository包进行配置
2.1调整AWR产生snapshot的频率和保留策略,如:如将收集间隔时间改为30 分钟一次。并且保留5天时间(注:单位都是为分钟):
exec dbms_workload_repository.modify_snapshot_settings(interval=>30, retention=>5*24*60);
2.2关闭AWR,把interval设为0则关闭自动捕捉快照
2.3手工创建一个快照
exec DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT ();
2.4 查看快照
select * from sys.wrh$_active_session_history
2.5手工删除指定范围的快照
exec WORKLOAD_REPOSITORY.DROP_SNAPSHOT_RANGE(low_snap_id => 22, high_snap_id => 32, dbid => 3310949047);
2.6创建baseline
exec dbms_workload_repository.create_baseline (56,59,’apply_interest_1′)
2.7删除baseline
exec DBMS_WORKLOAD_REPOSITORY.DROP_BASELINE(baseline_name => ‘ apply_interest_1′, cascade => FALSE);
3.生产AWR报告
$ORACLE_HOME/rdbms/admin/awrrpt.sql
Blogged with the Flock Browser
Tags: awr, 10g, oracle
email this | tag this | digg this | trackback | comment RSS feed
10月 17, 2008
By skywalker in DBA, 视野 |
Oracle Metalink帐号需要购买产品支持服务才可以拥有,而这个服务价格通常是产品价格的18%,非常贵。
DBA notes的Fenng分享了一个好方法:
购买
Oracle Collaboration Suite,单用户永久License,60美元
软件更新License与支持服务,15美元
一共75美元,即可拥有Metalink帐号
Blogged with the Flock Browser
Tags: metalink, 廉价, oracle
email this | tag this | digg this | trackback | comment RSS feed
10月 14, 2008
By skywalker in DBA |
[oracle@rac01 ~]$ crs_stat -t
Name Type Target State Host
————————————————————
ora.dppc.db application ONLINE ONLINE rac01
ora….c1.inst application ONLINE ONLINE rac01
ora….c2.inst application ONLINE ONLINE rac02
ora….01.lsnr application ONLINE ONLINE rac01
ora.rac01.gsd application ONLINE ONLINE rac01
ora.rac01.ons application ONLINE ONLINE rac01
ora.rac01.vip application ONLINE ONLINE rac01
ora….02.lsnr application ONLINE ONLINE rac02
ora.rac02.gsd application ONLINE UNKNOWN rac02
ora.rac02.ons application ONLINE UNKNOWN rac02
ora.rac02.vip application ONLINE ONLINE rac02
[oracle@rac01 ~]$ crs_stop [...]
email this | tag this | digg this | trackback | comment RSS feed
09月 25, 2008
By skywalker in DBA |
RAC一个节点遭遇这个ORA-600错误,系统是64位RHEL4+Oracle10.2.0.1
查metalink得知是由于UDP interconnect发送超时,在trace中可以找到这样的提示:
WARN: acconn …. getting closed. inactive: threshold: 0×0
WARN: potential problem in keep alive connection protocol
解决方法有2:
一是打补丁升级至10.2.0.2或更高版本
二是使用隐藏初始化变量”_skgxp_udp_ach_reaping_time”:
alter system set “_skgxp_udp_ach_reaping_time” = 0 scope=both;
Blogged with the Flock Browser
Tags: ora-600, kjzcreaprqhq1
email this | tag this | digg this | trackback | comment RSS feed
09月 25, 2008
By skywalker in DBA, shell |
SELECT D.TABLESPACE_NAME ,
SPACE “SUM_SPACE(M)” [...]
email this | tag this | digg this | trackback | comment RSS feed
09月 19, 2008
By skywalker in DBA, SQL |
sql中的like ‘%xx%’模糊查询无法走索引,影响执行速度。经测试itpub版主ifree的index_ffs+rowid方法比较有效,记录一下。
这里是示例:
scott@ORCL> CREATE INDEX SCOTT.i_dept_name
2 ON SCOTT.DEPT(DNAME)
3 ;
Index created.
scott@ORCL> Analyze Table SCOTT.DEPT Compute Statistics ;
Table analyzed.
scott@ORCL> select * from scott.dept where
2 rowid in (
3 select /*+ index_ffs(a i_dept_dname) */
4 rowid from scott.dept a where dname like ‘%A%’)
5 ;
这个方法要求like查询出的记录不能太多,在我的应用中,这一方法使sql效率提高了近10倍。
Blogged with the Flock Browser
Tags: sql, 优化, turning, like, 模糊查询
email this | tag this | digg this | trackback | comment RSS feed
08月 29, 2008
By skywalker in DBA |
在安装Oracle10g clusterware的过程中,经常会遇到错误导致安装失败,这时候需要清除所有已安装的信息,保证重新安装的顺利进行。
这个工作在不同平台上是略有差别,对于Redhat,需要作这样几步:
1、以root身份运行$ORA_CRS_HOME/install/rootdelete.sh
2、
rm -f /etc/init.d/init.cssd
rm -f /etc/init.d/init.crs
rm -f /etc/init.d/init.crsd
rm -f /etc/init.d/init.evmd
rm -f /etc/rc2.d/K96init.crs
[...]
email this | tag this | digg this | trackback | comment RSS feed
08月 28, 2008
By skywalker in DBA |
在Specify Cluster Configuration这一步配置好节点后,点next可能会遇到:
The specified nodes are not clusterable
INFO: Query Returned:
null
这是由于ssh的可信验证没有设置好:尽管已经配置了可信验证,但Clusterware要求hosts文件中各节点的public node name、private node name以及它们对应的别名,全部都通过ssh可信验证。
但由于ssh的特性,在第一次连接的时候,会提示是否添加新的key,如果事先没有将以上所有名称的对应key加上,Clusterware就会报上面的错误
解决方法很简单:对每个所需的name做一次ssh连接,将key加入每个节点中
Blogged with the Flock Browser
Tags: oracle, clusterware, ssh, rac
email this | tag this | digg this | trackback | comment RSS feed
08月 7, 2008
By skywalker in DBA |
1、运行runInstaller提示 操作系统版本检查失败
加 -ignoreSysPreReqs 参数忽略掉操作系统检查就可以安装了
2、安装窗口乱码
设置当前语言环境为英文即可
export LANG=en_US.UTF-8
3、安装到中途报错
Error in invoking target ‘utilities ctx_on’ of makefile ‘/opt/oracle10g/u01/app/oracle/product/10.2.0/db_1/rdbms/lib/ins_rdbms.mk’. See ‘/opt/oracle10g/u01/app/oraInventory/logs/installActions2006-08-12_11-54-03PM.log’ for details.
这是一个bug,解决方法是:
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
ln s /usr/bin/basename /bin/basename
ln s $ORACLE_HOME/lib/libclient10.a $ORACLE_HOME/lib/libagtsh.a
$ORACLE_HOME/bin/genagtsh $ORACLE_HOME/lib/libagtsh.so 1.0
Blogged with the Flock Browser
Tags: oracle, install, ubuntu
email this | tag this | digg this | trackback | comment RSS feed