今天玩vm的收获-1,LVM管理真方便-2,ip地址改完了别忘了修改listener和local_listener

今天继续整合vm,遇到两个问题,一个是,空间和一两句话说不清楚的目录问题,一个是ip地址问题,都是小蚂蚁问题,记录一下,好玩,O(∩_∩)O哈哈~
这个是空间问题:
你可以看到,我的这个有2个盘分别存放了grid软件和oracle软件,分别用了两个盘,分别挂载到两个目录: /u01 和 /u01/app/oracle
于是,我就想到应该扩展根目录,然后把tar文件放到根目录下,在解压,应该就自动合并到/u01/app/oracle了。

[root@lunar ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      7.8G  5.6G  1.8G  76% /
/dev/sda1              99M   50M   45M  53% /boot
tmpfs                 731M     0  731M   0% /dev/shm
/dev/sdc1              12G  7.7G  3.6G  69% /u01
/dev/sde1              12G  5.6G  5.7G  50% /u01/app/oracle
/dev/sdf1              30G  4.2G   24G  15% /other
[root@lunar ~]#

我的一个11.2.0.3的vm也是/u01/app/oracle目录。
我们都知道,使用root用户tar一个目录,解tar时,直接按照原有目录解压,但是今天测试了好几个参数,都不行
我怀疑就是因为不同的盘上有了相同的目录,比如/dev/sde1 挂载到了 /u01/app/oracle,跟不够大,我把tar过来的11.2.0.3.tar放到了新建的盘/dev/sdf1上
挂载到/other上,因此解压的时候,目录就变成/other/u01/app/oracle了
这样我的这套11.2的环境就有问题,需要修改一些东西,比较麻烦。。。

弄好后,测试下两个环境,一个oracle 12.1,一个是oracle 11.2.0.3

[oracle@lunar ~]$ cat ora12.env 
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/12.1/dbhome_1
export ORACLE_SID=lunarbb
#export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH=$ORACLE_HOME/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin:Xll:/sbin:/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;

export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"

umask 022
alias ss="sqlplus / as sysdba"
alias ll="ls -lrt"
set -o vi

[oracle@lunar ~]$ . ora12.env 
[oracle@lunar ~]$ 

这里启动数据库,遇到另一个小问题:

[oracle@lunar ~]$ ss

SQL*Plus: Release 12.1.0.1.0 Production on Mon Nov 11 14:00:14 2013

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SYS@lunarbb>create pfile='/tmp/a.ora' from spfile;
create pfile='/tmp/a.ora' from spfile
*
ERROR at line 1:
ORA-01565: error in identifying file '?/dbs/spfile@.ora'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3


Elapsed: 00:00:00.05
SYS@lunarbb>exit
Disconnected
[oracle@lunar ~]$ 

找不到spfile,检查下,果然没有spfile和init:


[oracle@lunar dbhome_1]$ pwd
/u01/app/oracle/product/12.1/dbhome_1
[oracle@lunar dbhome_1]$ cd dbs
[oracle@lunar dbs]$ ls
hc_lunarbb.dat  initlunarbb.ora.bak  init.ora.bak  lkLUNARBB  orapwlunarbb  PDB3.XML  pfile.bak  snapcf_lunarbb.f
[oracle@lunar dbs]$
[oracle@lunar dbs]$ cat initlunarbb.ora.bak
SPFILE='+DATA/lunarbb/spfilelunarbb.ora'
[oracle@lunar dbs]$ mv initlunarbb.ora.bak initlunarbb.ora
[oracle@lunar dbs]$

再重启,还是不行:
SYS@lunarbb>startup
ORA-00119: invalid specification for system parameter LOCAL_LISTENER
ORA-00130: invalid listener address '(ADDRESS=(PROTOCOL=TCP)(HOST=lunar)(PORT=192.168.56.129))'
SYS@lunarbb>

弄个pfile出来看看,把这个“鸡肋”LOCAL_LISTENER注释掉试试看,然后果然可以了,没有报其他错误了,说明我的vm还是好的
(最近每天折腾vm,都是从活动硬盘上copy回来的,总是有各种妖怪问题):

[oracle@lunar dbs]$ ss

SQL*Plus: Release 12.1.0.1.0 Production on Mon Nov 11 14:04:40 2013

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SYS@lunarbb>create pfile='/tmp/a.ora' from spfile='+DATA/lunarbb/spfilelunarbb.ora';

File created.

Elapsed: 00:00:00.28
SYS@lunarbb>

注释下面一行:
#*.local_listener='LISTENER_LUNARBB'

然后启动ok了
SYS@lunarbb>startup pfile=/tmp/a.ora
ORACLE instance started.

Total System Global Area  346562560 bytes
Fixed Size                  2288240 bytes
Variable Size             297797008 bytes
Database Buffers           37748736 bytes
Redo Buffers                8728576 bytes
Database mounted.
Database opened.
SYS@lunarbb>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@lunarbb>

我这个人养成了一种习惯,不找原因,先琢磨workround,但是回过头来,还是要看看怎么弄的


SYS@lunarbb>startup
ORA-00119: invalid specification for system parameter LOCAL_LISTENER
ORA-00130: invalid listener address '(ADDRESS=(PROTOCOL=TCP)(HOST=lunar)(PORT=192.168.56.129))'
SYS@lunarbb>

怀疑ip地址有问题,检查/etc/hosts,果然,这里的ip地址不对,从活动硬盘copy来的,里面ip沿用的以前的vm的配置:


[root@lunar product]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               lunar localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6

192.168.56.1 lunar-win
192.168.14.129  lunar

[root@lunar product]# 

再次启动还是不行。。。。。。
SYS@lunarbb>startup
ORA-00119: invalid specification for system parameter LOCAL_LISTENER
ORA-00130: invalid listener address '(ADDRESS=(PROTOCOL=TCP)(HOST=lunar)(PORT=192.168.56.129))'
SYS@lunarbb>

检查tnsnames.ora,发现问题了:


[oracle@lunar admin]$ cat tnsnames.ora 
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.1/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

LUNARBB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.129)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = lunarbb)
    )
  )

LISTENER_LUNARBB =
  (ADDRESS = (PROTOCOL = TCP)(HOST = lunar)(PORT = 192.168.56.129))

BBPDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.129)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = bb)
    )
  )
[oracle@lunar admin]$ 

这里 LISTENER_LUNARBB 使用的是机器名,而
oracle在启动的时候会根据local_listener参数的设置去找检查相应的主机名和端口号,我这里有两个错误:
1,主机名,很可能这里的HOST = lunar本身就有问题,因为我以前的老ip对应着现在的新ip的主机名,都是lunar
2,端口号写成了主机名(这个错误很奇怪,这东西按说都是自动生成的。。。。。。)


修改后,新的如下:
LISTENER_LUNARBB =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.129)(PORT = 1521))


再次启动,ok了,O(∩_∩)O哈哈~
SYS@lunarbb>startup
ORACLE instance started.

Total System Global Area  346562560 bytes
Fixed Size                  2288240 bytes
Variable Size             297797008 bytes
Database Buffers           37748736 bytes
Redo Buffers                8728576 bytes
Database mounted.
Database opened.
SYS@lunarbb>

今天还学习了一个,使用LVM管理,很方便的扩展一个目录,今天是扩展的根目录,感谢bbq同学O(∩_∩)O哈哈~
逻辑卷真方便,这里顺便记录一下:
假设你新加的硬盘是sdf
在vm上新建一个盘,使用fdisk -l找出这个盘,比如我这里是 /dev/sdf(比如,大小30g),然后创建pv:
pvcreate /dev/sdf

这里创建默认的rootvg是 VolGroup00:
vgextend VolGroup00 /dev/sdf

扩展逻辑卷,一般默认是VolGroup00做vg lv是LogVol00,我的这个是30g,但是要考虑到一部分管理空间,因此,可以使用类似29.5G左右:
lvextend -L+29.5G /dev/VolGroup00/LogVol00

然后再扩根目录:
resize2fs -p /dev/VolGroup00/LogVol00

现在再看就已经扩展好了,O(∩_∩)O哈哈~

[root@lunar ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       37G  5.6G   29G  17% /
/dev/sda1              99M   50M   45M  53% /boot
tmpfs                 731M     0  731M   0% /dev/shm
/dev/sdc1              12G  6.4G  4.9G  57% /u01
/dev/sde1              12G  9.7G  1.7G  86% /u01/app/oracle
[root@lunar ~]# 

当你查看逻辑卷的时候,会发现多了一个逻辑卷,大小是你的盘的10%左右:
[root@lunar ~]# lvdisplay
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol00
  VG Name                VolGroup00
  LV UUID                546Q5i-4IXf-ai8Q-zgCx-2siu-WSN9-54BcjP
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                37.47 GB
  Current LE             1199
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
   
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol01
  VG Name                VolGroup00
  LV UUID                zf7Ua0-IakS-0ZDO-cbt7-noxp-jmFA-W1p72w
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                3.91 GB
  Current LE             125
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
   
[root@lunar ~]# 

差点想删除,后来bbq说,这个是swap ,不能删除 *^_^*
[root@lunar ~]# cat /etc/fstab
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
/dev/sdc1     /u01            ext3       defaults     1 1
/dev/sde1     /u01/app/oracle            ext3       defaults     1 1

[root@lunar ~]# 

发表在 FAQ | 留下评论

不同版本客户端连接服务器的问题


[oracle@lunar ~]$ ss

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Nov 10 01:09:36 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

SYS@orcl>conn lunar/lunar@ora920
Connected.
LUNAR@ora920>conn lunar/lunar@ora817
Connected.
LUNAR@ora817>conn lunar/lunar@ora816
ERROR:
ORA-03134: Connections to this server version are no longer supported.


Warning: You are no longer connected to ORACLE.
LUNAR@ora817>

可以看到,从10.2开始,还支持连接oracle 817的数据库,但是已经不支持连接到oracle 816的数据库了,查了下文档,内容如下:
无标题

[oracle@lunar admin]$ ss

SQL*Plus: Release 9.2.0.4.0 - Production on Sun Nov 10 01:08:55 2013

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production

SQL> conn lunar/lunar@ora816
Connected.
SQL> conn lunar/lunar@ora817
Connected.
SQL> conn lunar/lunar@ora920
Connected.
SQL> conn lunar/lunar@ora102
Connected.
SQL> 

[oracle@lunar admin]$ ss

SQL*Plus: Release 8.1.6.0.0 - Production on Sun Nov 10 01:05:32 2013

(c) Copyright 1999 Oracle Corporation.  All rights reserved.

Connected to:
Oracle8i Enterprise Edition Release 8.1.6.1.0 - Production
With the Partitioning option
JServer Release 8.1.6.0.0 - Production

SQL> conn lunar/lunar
Connected.
SQL> conn lunar/lunar@ora102
Connected.
SQL> conn lunar/lunar@ora920
Connected.
SQL> conn lunar/lunar@ora817
Connected.
SQL> 

今天连接时遇到 TNS-12560: TNS:protocol adapter error,顺便说一下,这个问题比较常见,常见原因有几种:
1,防火墙设置问题,关闭防火墙(service iptables stop)
2,修改了/etc/hosts的ip地址后,需要重启listener
3,listener.log过大(新版本中这个问题好多了)
4,10g中有一个注明的bug,listener会启动一个子监听造成listener hang
5,tnsnames.ora中配置的ip地址等不对
。。。。。。。。。。。。。。。

发表在 FAQ | 留下评论

解除部分exadata上的“强安全策略”

在安装Exadata时,执行onecommand的后面几步ResecureMachine相关的内容后,安全性会得到增强,我们戏称为“强安全步骤”,不同的onecommand版本的step稍有差别,但是可以从deploy脚步的执行步骤的名称中识别出来,例如onecommand p14210449 (对应image 11.2.3.1.1)的如下(其中setp24~setp26):

[root@dm01db01 onecommand]# ./deploy11203.sh -l
INFO: Logging all actions in /opt/oracle.SupportTools/onecommand/tmp/dm01db01-20120330102340.log and traces in /opt/oracle.SupportTools/onecommand/tmp/dm01db01-20120330102340.trc
INFO: Loading configuration file /opt/oracle.SupportTools/onecommand/onecommand.params...
The steps in order are...
Step  0 = ValidateEnv
Step  1 = CreateWorkDir
Step  2 = UnzipFiles
Step  3 = setupSSHroot
Step  4 = UpdateEtcHosts
Step  5 = CreateCellipinitora
Step  6 = ValidateIB
Step  7 = ValidateCell
Step  8 = PingRdsCheck
Step  9 = RunCalibrate
Step 10 = CreateUsers
Step 11 = SetupSSHusers
Step 12 = CreateGridDisks
Step 13 = GridSwInstall
Step 14 = PatchGridHome
Step 15 = RelinkRDSGI
Step 16 = GridRootScripts
Step 17 = DbSwInstall
Step 18 = PatchDBHomes
Step 19 = CreateASMDiskgroups
Step 20 = DbcaDB
Step 21 = DoUnlock
Step 22 = RelinkRDSDb
Step 23 = LockUpGI
Step 24 = ApplySecurityFixes
Step 25 = SetupCellEmailAlerts
Step 26 = ResecureMachine
[root@dm01db01 onecommand]#

在onecommand p16383189(对应 image 11.2.3.2.0,image 11.2.3.2.1的步骤跟这个一样的)中是如下步骤,其中step25~step28是“强安全”:

[root@dm01db01 onecommand]# ./deploy11203.sh -l
INFO: Logging all actions in /opt/oracle.SupportTools/onecommand/tmp/dm01db01-20130329155618.log and traces in /opt/oracle.SupportTools/onecommand/tmp/dm01db01-20130329155618.trc
INFO: Loading configuration file /opt/oracle.SupportTools/onecommand/onecommand.params...
The steps in order are...
Step  0 = ValidateEnv
Step  1 = CreateWorkDir
Step  2 = UnzipFiles
Step  3 = setupSSHroot
Step  4 = UpdateEtcHosts
Step  5 = CreateCellipinitora
Step  6 = ValidateIB
Step  7 = UpdateCell
Step  8 = ValidateCell
Step  9 = PingRdsCheck
Step 10 = RunCalibrate
Step 11 = CreateUsers
Step 12 = SetupSSHusers
Step 13 = CreateGridDisks
Step 14 = GridSwInstall
Step 15 = PatchGridHome
Step 16 = RelinkRDSGI
Step 17 = GridRootScripts
Step 18 = DbSwInstall
Step 19 = PatchDBHomes
Step 20 = CreateASMDiskgroups
Step 21 = DbcaDB
Step 22 = DoUnlock
Step 23 = RelinkRDSDb
Step 24 = LockUpGI
Step 25 = ApplySecurityFixes
Step 26 = setupASR
Step 27 = SetupCellEmailAlerts
Step 28 = ResecureMachine
[root@dm01db01 onecommand]#

在执行了上述步骤后,一些客户使用一段时间后对于其中的“强安全”感觉很不方便,希望我们修改其中的部分限制,比如90天必须修改口令等等,下面就类似问题给出解决方案。
本文的方法来自于内部exadata的一个文档,且在多个客户都已经实施过了:
1, 解除口令限制和复杂度:
使用root用户修改/etc/pam.d/system-auth,这是一个password的的入口文件(老一点的linux系统一般用/etc/pam.d/passwd),将其中的”min=disabled,disabled,16,12,8″ ,使用这个规则建立的口令很难被破解,修改为”min=1,1,1,1,1″,大大降低了口令的复杂程度(容易被破解,例如“oracle”,或者exadata上的缺省的welcome等等,都是常用词汇。。。)
然后重置root口令即可(exadata上大部分缺省口令是welcome)
2, 解除90修改口令的限制:
执行下面的命令修改用户口令修改策略:

chage -d 14000 -E -1 -m 0 -M -1 <username>
例如:
chage -d 14000 -E -1 -m 0 -M -1 root (both db and cell nodes)
chage -d 14000 -E -1 -m 0 -M -1 oracle  (on db nodes)
chage -d 14000 -E -1 -m 0 -M -1 celladmin  (on cell nodes)
chage -d 14000 -E -1 -m 0 -M -1 cellmonitor (on cell nodes)

当然,你需要在所有节点依次执行,exadata上的dcli可以很方便的完成:

## for db nodes
dcli -g dbs_group -l root "chage -d 14000 -E -1 -m 0 -M -1 root && chage -d 14000 -E -1 -m 0 -M -1 oracle && chage -d 14000 -E -1 -m 0 -M -1 grid"

## for cell nodes
dcli -g /opt/oracle.SupportTools/onecommand/cell_group -l root "chage -d 14000 -E -1 -m 0 -M -1 root && chage -d 14000 -E -1 -m 0 -M -1 celladmin && chage -d 14000"

然后使用上述用户登录的缺省口令就可以登录了(缺省口令都是welcome)
3, 重新配置各个节点的SSH信任关系(因为执行了ResecureMachine以后,SSH信任关系操作就不可以了):

/opt/oracle.SupportTools/setup_ssh_eq.sh /opt/oracle.SupportTools/onecommand/all_group root <passwd>

也可以参考我之前的一篇blog(其中的脚本在11.2.0.1的除windows平台外的任何一个安装包中都可以找到):
使用Oracle安装包的ssh配置机器互信
注意: 如果有问题可以参考bug 12389246
4, 解除SSH连接超时的限制:

dcli -g all_group -l root "cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig; sed -i 's/^ClientAliveInterval/#ClientAliveInterval/' /etc/ssh/sshd_config; service sshd restart"

顺便多说一下,由于某些原因用户可能会出现密码尝试次数过多账号被锁定的问题,具体的设置在/etc/pam.d/system-auth文件,例如,exadata上的:

#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth        required      pam_env.so
auth        required    pam_unix.so try_first_pass nullok
#auth        required      pam_deny.so

account     required      pam_unix.so

password    requisite     pam_passwdqc.so min=5,5,5,5,5 similar=deny enforce=everyone max=40
password    sufficient    pam_unix.so try_first_pass use_authtok nullok md5 shadow remember=10
password    required      pam_deny.so

session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so

清除某个用户的登陆失败次数,让改用户可以重新登陆的命令:
pam_tally2 -r -u username
例如,
清除 oracle用户的失败登录次数:pam_tally2 -r -u oracle
清除 oracle用户的失败登录次数:pam_tally2 -r -u root

发表在 FAQ, 日常运维 | 标签为 | 留下评论

一个老系统的老问题:ORA-01031: insufficient privileges

今天打算整合一下所有的vm(除了12c),把他们都放到一个vm中,结果发现遇到郁闷问题:

[oracle@lunar dbs]$ ss

SQL*Plus: Release 9.2.0.4.0 - Production on Sat Nov 9 20:40:25 2013

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

ERROR:
ORA-01031: insufficient privileges


Enter user-name: 
[oracle@lunar dbs]$

–第一反应是口令文件有问题,于是检查,发现果然缺少口令文件:

[oracle@lunar dbs]$ pwd
/oracle/9.2.0/orahome/dbs
[oracle@lunar dbs]$ ll
total 52
-rw-r--r--  1 oracle oinstall 12920 Mar  9  2002 initdw.ora
-rw-r--r--  1 oracle oinstall  8385 Mar 10  2002 init.ora
-rw-rw----  1 oracle oinstall    24 Oct  9 10:27 lkLUNAR
-rw-r-----  1 oracle oinstall  2560 Nov  9 13:45 spfilelunar.ora
[oracle@lunar dbs]$

--自己生成一个:
[oracle@lunar dbs]$ orapwd file=/oracle/9.2.0/orahome/dbs/orapwlunar password=oracle entries=10
[oracle@lunar dbs]$ ll
total 60
-rw-r--r--  1 oracle oinstall 12920 Mar  9  2002 initdw.ora
-rw-r--r--  1 oracle oinstall  8385 Mar 10  2002 init.ora
-rw-rw----  1 oracle oinstall    24 Oct  9 10:27 lkLUNAR
-rwSr-----  1 oracle oinstall  2560 Nov  9 20:44 orapwlunar
-rw-r-----  1 oracle oinstall  2560 Nov  9 13:45 spfilelunar.ora
[oracle@lunar dbs]$ ss

SQL*Plus: Release 9.2.0.4.0 - Production on Sat Nov 9 20:44:25 2013

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

ERROR:
ORA-01031: insufficient privileges


Enter user-name: 
[oracle@lunar dbs]$
[oracle@lunar dbs]$ ll
total 60
-rw-r--r--  1 oracle oinstall 12920 Mar  9  2002 initdw.ora
-rw-r--r--  1 oracle oinstall  8385 Mar 10  2002 init.ora
-rw-rw----  1 oracle oinstall    24 Oct  9 10:27 lkLUNAR
-rwSr-----  1 oracle oinstall  2560 Nov  9 20:44 orapwlunar
-rw-r-----  1 oracle oinstall  2560 Nov  9 13:45 spfilelunar.ora
[oracle@lunar dbs]$ 

–还是不行,是否因为大小写的关系(因为之前的那个vm已经迁移到活动硬盘了,懒得打开查看SID了),因此修改为大写试试看:

[oracle@lunar dbs]$mv orapwlunar orapwLUNAR
[oracle@lunar dbs]$ ss

SQL*Plus: Release 9.2.0.4.0 - Production on Sat Nov 9 20:45:07 2013

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

ERROR:
ORA-01031: insufficient privileges


Enter user-name: 
[oracle@lunar dbs]$ 

--还是不行啊,改回来吧
[oracle@lunar dbs]$ mv orapwLUNAR orapwlunar
[oracle@lunar dbs]$ ll
total 60
-rw-r--r--  1 oracle oinstall 12920 Mar  9  2002 initdw.ora
-rw-r--r--  1 oracle oinstall  8385 Mar 10  2002 init.ora
-rw-rw----  1 oracle oinstall    24 Oct  9 10:27 lkLUNAR
-rwSr-----  1 oracle oinstall  2560 Nov  9 20:44 orapwlunar
-rw-r-----  1 oracle oinstall  2560 Nov  9 13:45 spfilelunar.ora
[oracle@lunar dbs]$ 

–使用密码文件的认证方式测试本地登录是可以的:

[oracle@lunar dbs]$ sqlplus 'sys/oracle as sysdba'

SQL*Plus: Release 9.2.0.4.0 - Production on Sat Nov 9 20:47:30 2013

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area  135337420 bytes
Fixed Size                   452044 bytes
Variable Size             109051904 bytes
Database Buffers           25165824 bytes
Redo Buffers                 667648 bytes
Database mounted.
Database opened.
SQL> alter user sys identified by oracle;

User altered.

SQL> alter user system identified by oracle;

User altered.

SQL> conn / as sysdba           --但是使用OS认证的登录方式还是不行
ERROR:
ORA-01031: insufficient privileges


Warning: You are no longer connected to ORACLE.
SQL> conn sys/oracle as sysdba
Connected.
SQL> show parameter pass

NAME                                 TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
remote_login_passwordfile            string
EXCLUSIVE
SQL> 

–怀疑是sqlnet.ora的设置有问题,结果居然没有,这个vm是7,8年前的,不知道什么原因,居然没有这个文件,创建一个吧:

[oracle@lunar admin]$ ll
total 52
-rw-r--r--  1 oracle oinstall  825 Jul 26  2003 libnk59.def
-rw-r--r--  1 oracle oinstall  657 Oct  9 10:27 listener.ora
drwxr-xr-x  2 oracle oinstall 4096 Oct  9 10:04 samples
-rw-r--r--  1 oracle oinstall  130 Mar 19  2002 shrept.lst
-rw-r--r--  1 oracle oinstall   24 Aug  8  2000 snmp_ro.ora
-rw-r--r--  1 oracle oinstall  579 Oct  9 10:27 tnsnames.ora
[oracle@lunar admin]$ 

[oracle@lunar admin]$ vi sqlnet.ora 
# Generated by Oracle configuration tools.

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

[oracle@lunar admin]$ ll
total 52
-rw-r--r--  1 oracle oinstall  825 Jul 26  2003 libnk59.def
-rw-r--r--  1 oracle oinstall  657 Oct  9 10:27 listener.ora
drwxr-xr-x  2 oracle oinstall 4096 Oct  9 10:04 samples
-rw-r--r--  1 oracle oinstall  130 Mar 19  2002 shrept.lst
-rw-r--r--  1 oracle oinstall   24 Aug  8  2000 snmp_ro.ora
-rwxrwxrwx  1 oracle oinstall   89 Nov  9 21:25 sqlnet.ora
-rw-r--r--  1 oracle oinstall  579 Oct  9 10:27 tnsnames.ora
[oracle@lunar admin]$ 

--创建好了,再试试看:
[oracle@lunar admin]$ ss
Message 395 not found;  product=SQLPlus; facility=SP2
Message 396 not found;  product=SQLPlus; facility=SP2
Message 397 not found;  product=SQLPlus; facility=SP2
Message 398 not found;  product=SQLPlus; facility=SP2
Message 399 not found;  product=SQLPlus; facility=SP2
Message 400 not found;  product=SQLPlus; facility=SP2
Message 403 not found;  product=SQLPlus; facility=SP2
Message 743 not found;  product=SQLPlus; facility=SP2
Message 402 not found;  product=SQLPlus; facility=SP2
Message 401 not found;  product=SQLPlus; facility=SP2
[oracle@lunar admin]$ env|grep ORA
ORACLE_SID=orcl
ORACLE_BASE=/home/oracle/oracle/product
ORA_NLS33=/oracle/9.2.0/orahome/ocommon/nls/admin/data
ORACLE_HOME=/home/oracle/oracle/product/10.2.0/db_1
[oracle@lunar admin]$ 

–这里居然冒出来ORACLE_HOME设置不对,郁闷了。。。。。。

–重新执行环境设置脚本:

[oracle@lunar admin]$ cat ~/ora920.env 
export ORACLE_BASE=/oracle/9.2.0
export ORACLE_HOME=$ORACLE_BASE/orahome
export ORACLE_SID=lunar
export PATH=$ORACLE_HOME/bin:$PATH
export LIBPATH=$ORACLE_HOME/lib
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data;
export NLS_LANG=american_america.AL32UTF8

alias ss="sqlplus '/ as sysdba'"

[oracle@lunar admin]$ 

--然后再试试看:
[oracle@lunar admin]$ ss

SQL*Plus: Release 9.2.0.4.0 - Production on Sat Nov 9 20:57:59 2013

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

ERROR:
ORA-01031: insufficient privileges


Enter user-name: 
[oracle@lunar admin]$ 
[oracle@lunar admin]$ 

–这是,怀疑是oracle用户本身的问题,于是检查oracle用户的属组:

[oracle@lunar admin]$ id oracle
uid=500(oracle) gid=500(oinstall) groups=500(oinstall)
[oracle@lunar admin]$ id
uid=500(oracle) gid=500(oinstall) groups=500(oinstall) context=user_u:system_r:unconfined_t
[oracle@lunar admin]$ 

–经过小伙伴的提醒,发现这个VM居然使用了破烂SELinux,sigh。。。。。

[root@lunar ~]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=enforcing
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

–SELinux系统比起通常的Linux系统来,安全性能要高的多,它通过对于用户,进程权限的最小化,即使受到攻击,进程或者用户权限被夺去,也不会对整个系统造成重大影响。
–但是往往有些应用的使用也会受到限制,比如有时候tar一个大目录的时候可能会失败,有时候ftp东西的时候有问题,等等
–其实一般ORACLE的文档上也是明确说明要关闭SELinux的,例如:
–5.11 Error While Loading Shared Library When SELinux is Enabled on Red Hat Enterprise Linux 5
–SQL*Plus and Oracle Call Interface (OCI) program calls fail when selinux is in Enforcing mode on Red Hat Enterprise Linux 5.
–Workaround: Shift selinux to Permissive mode on the system.
–This issue is tracked with Oracle bug 6079461.

–于是,将 SELINUX=enforcing 修改为 SELINUX=disabled,这样,下次启动系统后将会停止SElinux
–当然,也可以修改linux启动内核的参数:

[root@lunar ~]# cat /boot/grub/menu.lst
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
#          initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux AS (2.6.9-42.ELsmp)
        root (hd0,0)
        kernel /vmlinuz-2.6.9-42.ELsmp ro root=/dev/VolGroup00/LogVol00 rhgb quiet selinux=0
        initrd /initrd-2.6.9-42.ELsmp.img
title Red Hat Enterprise Linux AS-up (2.6.9-42.EL)
        root (hd0,0)
        kernel /vmlinuz-2.6.9-42.EL ro root=/dev/VolGroup00/LogVol00 rhgb quiet selinux=0
        initrd /initrd-2.6.9-42.EL.img
[root@lunar ~]# 

–顺便记录和检查下当前SELINUX的policy:

[root@lunar ~]# sestatus
SELinux status:         enabled  --已经启用了
SELinuxfs mount:        /selinux
Current mode:           permissive  --当前模式是警告模式
Mode from config file:  error (Success)
Policy version:         18
Policy from config file:targeted

Policy booleans:
allow_syslog_to_console inactive
allow_ypbind            inactive
dhcpd_disable_trans     inactive
httpd_builtin_scripting active
httpd_disable_trans     inactive
httpd_enable_cgi        active
httpd_enable_homedirs   active
httpd_ssi_exec          active
httpd_tty_comm          inactive
httpd_unified           active
mysqld_disable_trans    inactive
named_disable_trans     inactive
named_write_master_zonesinactive
nscd_disable_trans      inactive
ntpd_disable_trans      inactive
pegasus_disable_trans   inactive
portmap_disable_trans   inactive
postgresql_disable_transinactive
snmpd_disable_trans     inactive
squid_disable_trans     inactive
syslogd_disable_trans   inactive
use_nfs_home_dirs       inactive
use_samba_home_dirs     inactive
use_syslogng            inactive
winbind_disable_trans   inactive
ypbind_disable_trans    inactive
[root@lunar ~]# 

–重启linux系统后,检查是否已经关闭SELinux:

[root@lunar ~]# getenforce
Disabled
[root@lunar ~]# 

--再次启动sqlplus,看来已经ok了,O(∩_∩)O哈哈~
[oracle@lunar ~]$ . ora920.env 
[oracle@lunar admin]$ ss

SQL*Plus: Release 9.2.0.4.0 - Production on Sat Nov 9 21:25:40 2013

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

Connected to an idle instance.

SQL> 


发表在 FAQ, ORA-XXXXX | 留下评论

收集ASM的信息

当ASM出现故障时,需要收集的主要信息如下(来自于MOS,log SR时,通常让你提供alert,trace和这些信息),

SPOOL ASM_FIRST<instance#>.HTML
SET MARKUP HTML ON
set echo on

set pagesize 200

alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS';

select 'THIS ASM REPORT WAS GENERATED AT: ==)> ' , sysdate " " from dual;


select 'HOSTNAME ASSOCIATED WITH THIS ASM INSTANCE: ==)> ' , MACHINE " " from v$session where program like '%SMON%';

select * from v$asm_diskgroup;

SELECT * FROM V$ASM_DISK ORDER BY GROUP_NUMBER,DISK_NUMBER;

SELECT GROUP_NUMBER,DISK_NUMBER, NAME, TOTAL_MB, FREE_MB FROM V$ASM_DISK ORDER BY GROUP_NUMBER,DISK_NUMBER;

SELECT COUNT (PXN_KFFXP), DISK_KFFXP, GROUP_KFFXP FROM X$KFFXP GROUP BY DISK_KFFXP, GROUP_KFFXP ORDER BY GROUP_KFFXP,DISK_KFFXP;

SELECT * FROM V$ASM_CLIENT;

select * from V$ASM_ATTRIBUTE;

select * from v$asm_operation;
select * from gv$asm_operation
SELECT * FROM V$ASM_CLIENT;

select * from v$version;

show parameter asm
show parameter cluster
show parameter instance_type
show parameter instance_name
show parameter spfile

show sga

spool off

 


发表在 ASM | 标签为 , | 留下评论

结合event 10046跟踪ASM的所有操作

关于ASM的限制,请参见 ASM – Scalability and Limits (Doc ID 370921.1)

ASM imposes the following limits:
		63 disk groups in a storage system

		10,000 ASM disks in a storage system

		2 terabyte maximum storage for each ASM disk (the Bug 6453944 allowed larger sizes, but that led to problems, see Note 736891.1 "ORA-15196 WITH ASM DISKS LARGER THAN 2TB")

		40 exabyte maximum storage for each storage system

		1 million files for each disk group

		2.4 terabyte maximum storage for each file

有朋友说12.1上已经可以创建2T的文件,事实上,在很多时候,我们还是不建议这样使用,bug依然存在,维护还是问题。。。。。
例如:
Bug 14181123 ROOT.SH HANGS ON OHASD.BIN REBOOT
Bug 16565325 ASM FILE CREATION PERFORMANCE REGRESSION

当你碰到ASM的一些报错或者bug,怎么去检查问题呢?
前面已经说过使用DBI_TRACE去trace asm的过程,这里再说下,结合event 10046去诊断问题。
比如一个场景,客户反映在ASM上创建表空间很慢,或者cp很慢,或者其他。。。。。很慢的问题,那么首先我们先设置 DBI_TRACE=1 来跟踪ASM的内部操作:

[grid@RAC1 ~]$ export DBI_TRACE=1
[grid@RAC1 ~]$ asmcmd
    DBI 1.602-ithread default trace level set to 0x0/1 (pid 4739) at DBI.pm line 273 via asmcmdshare.pm line 204
    -> DBI->connect(dbi:Oracle:, , ****, HASH(0x16b8c38))
    -> DBI->install_driver(Oracle) for linux perl=5.010000 pid=4739 ruid=1100 euid=1100
       install_driver: DBD::Oracle version 1.20 loaded from /u01/11.2.0/grid/perl/lib/site_perl/5.10.0/x86_64-linux-thread-multi/DBD/Oracle.pm
    <- STORE('ShowErrorStatement', 1)= 1 at Oracle.pm line 62
    <- install_driver= DBI::dr=HASH(0x1b763c0)
    <- default_user(undef, undef, ...)= ( undef undef ) [2 items] at DBI.pm line 625
    <- DESTROY(DBI::st=HASH(1b12030))= undef at Oracle.pm line 234
    <- connect('', undef, ...)= DBI::db=HASH(0x1b11f10) at DBI.pm line 637
    <- STORE('PrintError', 0)= 1 at DBI.pm line 689
    <- STORE('AutoCommit', 1)= 1 at DBI.pm line 689
    <- STORE('Username', undef)= 1 at DBI.pm line 692
    <> FETCH('Username')= undef ('Username' from cache) at DBI.pm line 692
$h->{'ora_session_mode'}=32768 ignored for invalid driver-specific attribute
    <- STORE('ora_session_mode', 32768)= '' at DBI.pm line 692
    <- FETCH('ora_session_mode')= undef at DBI.pm line 692
    <- connected('dbi:Oracle:', undef, ...)= undef at DBI.pm line 698
    <- connect= DBI::db=HASH(0x1b11f10)
    <- STORE('dbi_connect_closure', CODE(0x1b7e3b8))= 1 at DBI.pm line 707
    <- prepare('/* ASMCMD */ select version from v$instance')= DBI::st=HASH(0xde9f58) at asmcmdshare.pm line 2678
    <- execute= '0E0' at asmcmdshare.pm line 2697
    <- fetchrow_hashref= HASH(0x1b12570)1keys row1 at asmcmdshare.pm line 2723
    <- finish= 1 at asmcmdshare.pm line 2744
    <- DESTROY(DBI::st=HASH(1b11f40))= undef at asmcmdcore line 414
ASMCMD> 

这里你可以看到ASM的每一个操作的详细的执行情况

然后,我们设置event 10046来跟踪该进程的执行情况

SQL> oradebug setospid 4742
Oracle pid: 27, Unix process pid: 4742, image: oracle@RAC1 (TNS V1-V3)
SQL> oradebug event 10046 trace name context forever, level 12
Statement processed.
SQL> oradebug dump errorstack 3
Statement processed.
SQL> oradebug tracefile_name
/u01/app/grid/diag/asm/+asm/+ASM1/trace/+ASM1_ora_4742.trc
SQL> 

例如,我们将 +ASMDATA/RACDB/datafile/USERS.259.814462681 复制到/home/grid/asmfile

ASMCMD> cp +ASMDATA/RACDB/datafile/USERS.259.814462681 /home/grid/asmfile

看下,文件已经复制成功:
[grid@RAC1 asmfile]$ ls -lrt
total 5156
-rw-r--r-- 1 grid oinstall   10955 May 18 13:44 core_asmfile.pl
-rw-r--r-- 1 grid oinstall     643 May 18 13:44 asmfile
-rw-r----- 1 grid oinstall 5251072 Nov  1 11:41 USERS.259.814462681
[grid@RAC1 asmfile]$ 

现在我们使用tkprof进行格式化:

[grid@RAC1 trace]$ tkprof /u01/app/grid/diag/asm/+asm/+ASM1/trace/+ASM1_ora_4742.trc /u01/app/grid/diag/asm/+asm/+ASM1/trace/+ASM1_ora_4742.trc.out

TKPROF: Release 11.2.0.3.0 - Development on Fri Nov 1 11:48:08 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


[grid@RAC1 trace]$

可以看到,trace中显示了每一步我所执行的操作映射成ASM内部操作的过程和执行计划,时间等等详细信息,根据这个,不难找出瓶颈或者问题了吧,O(∩_∩)O哈哈~

TKPROF: Release 11.2.0.3.0 - Development on Fri Nov 1 11:48:08 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Trace file: /u01/app/grid/diag/asm/+asm/+ASM1/trace/+ASM1_ora_4742.trc
Sort options: default

********************************************************************************
count    = number of times OCI procedure was executed
cpu      = cpu time in seconds executing 
elapsed  = elapsed time in seconds executing
disk     = number of physical reads of buffers from disk
query    = number of buffers gotten for consistent read
current  = number of buffers gotten in current mode (usually for update)
rows     = number of rows processed by the fetch or execute call
********************************************************************************

SQL ID: acnhubu2pzw1k Plan Hash: 486334127

select * 
from
 v$asm_diskgroup_stat


call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.07          0          0          0           0
Execute      1      0.00       0.00          0          0          0           0
Fetch        1      0.02       0.43          0          0          0           2
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        3      0.03       0.51          0          0          0           2

Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: SYS
Number of plan statistics captured: 1

Rows (1st) Rows (avg) Rows (max)  Row Source Operation
---------- ---------- ----------  ---------------------------------------------------
         2          2          2  FIXED TABLE FULL X$KFGRP_STAT (cr=0 pr=0 pw=0 time=434753 us)


Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to client                       3        0.00          0.00
  SQL*Net message from client                     3        5.01          5.01
  GCS lock cvt S                                  2        0.02          0.02
  GCS lock open S                                 8        0.03          0.05
  Disk file operations I/O                        3        0.00          0.00
  kfk: async disk IO                             12        0.00          0.01
********************************************************************************

SQL ID: 9gzq03ud5hkc4 Plan Hash: 486334127

select group_number, state 
from
 v$asm_diskgroup_stat where name='DATA'


call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        2      0.00       0.01          0          0          0           0
Execute      2      0.00       0.00          0          0          0           0
Fetch        2      0.00       0.00          0          0          0           2
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        6      0.00       0.01          0          0          0           2

Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: SYS
Number of plan statistics captured: 2

Rows (1st) Rows (avg) Rows (max)  Row Source Operation
---------- ---------- ----------  ---------------------------------------------------
         1          1          1  FIXED TABLE FULL X$KFGRP_STAT (cr=0 pr=0 pw=0 time=68 us)


Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to client                       6        0.00          0.00
  SQL*Net message from client                     6        1.19          1.19
********************************************************************************

SQL ID: 75uwbs5dk1u8s Plan Hash: 3937404369

select to_char(current_date, 'J') "JULIAN_DATE" 
from
 dual


call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        3      0.02       0.50          0          0          0           0
Execute      3      0.00       0.00          0          0          0           0
Fetch        3      0.00       0.00          0          0          0           3
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        9      0.02       0.52          0          0          0           3

Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: SYS
Number of plan statistics captured: 3

Rows (1st) Rows (avg) Rows (max)  Row Source Operation
---------- ---------- ----------  ---------------------------------------------------
         1          1          1  FIXED TABLE FULL X$DUAL (cr=0 pr=0 pw=0 time=47 us)


Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to client                       9        0.00          0.00
  SQL*Net message from client                    10      387.59        387.59
  library cache lock                              1        0.03          0.03
  library cache pin                               1        0.00          0.00
********************************************************************************

SQL ID: 4zsbm8qz3sfw8 Plan Hash: 0

select inst_id, name_kfals, group_kfals, number_kfals, incarn_kfals,  
  entnum_kfals,  entinc_kfals, parent_kfals,  refer_kfals,   
  decode(bitand(entflg_kfals, 12), 4, 'Y', 8, 'Y', 'N'),  
  decode(bitand(entflg_kfals, 15), 1, 'N', 2, 'Y', 4, 'Y', 8, 'N')  
from
 x$kfals  where decode(bitand(entflg_kfals, 12), 4, 'Y', 8, 'Y', 'N') = 'Y' 
  OR        decode(bitand(entflg_kfals, 16), 16, 'Y', 'N') = 'Y'


call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.03          0          0          0           0
Execute      0      0.00       0.00          0          0          0           0
Fetch        0      0.00       0.00          0          0          0           0
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        1      0.00       0.03          0          0          0           0

Misses in library cache during parse: 1
Optimizer mode: CHOOSE
Parsing user id: SYS   (recursive depth: 2)
********************************************************************************

SQL ID: fx7ssvgfs8vpv Plan Hash: 0

select name, group_number, file_number, file_incarnation,  alias_index, 
  alias_incarnation, parent_index, reference_index,  alias_directory, 
  system_created  
from
 gv$asm_alias where inst_id = USERENV('Instance')


call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.09          0          0          0           0
Execute      0      0.00       0.00          0          0          0           0
Fetch        0      0.00       0.00          0          0          0           0
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        1      0.00       0.09          0          0          0           0

Misses in library cache during parse: 1
Optimizer mode: CHOOSE
Parsing user id: SYS   (recursive depth: 1)
********************************************************************************

/* ASMCMD */ select name,
                       group_number,
                       file_number,
                       reference_index,
                       parent_index, 
                       alias_directory, 
                       system_created
                  from v$asm_alias where group_number=2 and parent_index=33554432

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.03          0          0          0           0
Execute      1      0.00       0.00          0          0          0           0
Fetch        1      0.00       0.02          0          0          0           1
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        3      0.00       0.06          0          0          0           1

Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: SYS
Number of plan statistics captured: 1

Rows (1st) Rows (avg) Rows (max)  Row Source Operation
---------- ---------- ----------  ---------------------------------------------------
         1          1          1  FIXED TABLE FIXED INDEX X$KFALS (ind:4) (cr=0 pr=0 pw=0 time=20100 us)


Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to client                       3        0.00          0.00
  SQL*Net message from client                     3      158.03        158.03
  GCS lock open S                                 2        0.00          0.00
  kfk: async disk IO                              2        0.00          0.00
  Disk file operations I/O                        1        0.00          0.00
********************************************************************************

SQL ID: dykkcht6fux3m Plan Hash: 486334127

select group_number, state 
from
 v$asm_diskgroup_stat where name='ASMDATA'


call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        3      0.00       0.00          0          0          0           0
Execute      3      0.00       0.00          0          0          0           0
Fetch        3      0.00       0.00          0          0          0           3
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        9      0.00       0.00          0          0          0           3

Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: SYS
Number of plan statistics captured: 3

Rows (1st) Rows (avg) Rows (max)  Row Source Operation
---------- ---------- ----------  ---------------------------------------------------
         1          1          1  FIXED TABLE FULL X$KFGRP_STAT (cr=0 pr=0 pw=0 time=126 us)


Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to client                       9        0.00          0.00
  SQL*Net message from client                     9        0.00          0.00
********************************************************************************

SQL ID: ctvfwrrhcwx0v Plan Hash: 2683990587

select reference_index 
from
 v$asm_alias where group_number=1 and parent_index=16777216 and upper(name)=
  'RACDB'


call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        3      0.00       0.00          0          0          0           0
Execute      3      0.00       0.00          0          0          0           0
Fetch        3      0.00       0.00          0          0          0           3
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        9      0.00       0.00          0          0          0           3

Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: SYS
Number of plan statistics captured: 3

Rows (1st) Rows (avg) Rows (max)  Row Source Operation
---------- ---------- ----------  ---------------------------------------------------
         1          1          1  FIXED TABLE FIXED INDEX X$KFALS (ind:4) (cr=0 pr=0 pw=0 time=147 us)


Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to client                       9        0.00          0.00
  SQL*Net message from client                     9        0.00          0.00
********************************************************************************

SQL ID: 5463x46jn1c70 Plan Hash: 2683990587

select reference_index 
from
 v$asm_alias where group_number=1 and parent_index=16777269 and upper(name)=
  'DATAFILE'


call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        3      0.00       0.00          0          0          0           0
Execute      3      0.00       0.00          0          0          0           0
Fetch        3      0.00       0.00          0          0          0           3
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        9      0.00       0.00          0          0          0           3

Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: SYS
Number of plan statistics captured: 3

Rows (1st) Rows (avg) Rows (max)  Row Source Operation
---------- ---------- ----------  ---------------------------------------------------
         1          1          1  FIXED TABLE FIXED INDEX X$KFALS (ind:4) (cr=0 pr=0 pw=0 time=205 us)


Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to client                       9        0.00          0.00
  SQL*Net message from client                     9       15.96         15.97
********************************************************************************

/* ASMCMD */ select name,
                       group_number,
                       file_number,
                       reference_index,
                       parent_index, 
                       alias_directory, 
                       system_created
                  from v$asm_alias where group_number=1 and upper(name) like 'DATAFILE' and reference_index=16777322 and parent_index=16777269

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.00          0          0          0           0
Execute      1      0.00       0.00          0          0          0           0
Fetch        1      0.00       0.00          0          0          0           1
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        3      0.00       0.00          0          0          0           1

Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: SYS
Number of plan statistics captured: 1

Rows (1st) Rows (avg) Rows (max)  Row Source Operation
---------- ---------- ----------  ---------------------------------------------------
         1          1          1  FIXED TABLE FIXED INDEX X$KFALS (ind:4) (cr=0 pr=0 pw=0 time=565 us)


Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to client                       3        0.00          0.00
  SQL*Net message from client                     3        0.00          0.00
********************************************************************************

/* ASMCMD */ select name,
                       group_number,
                       file_number,
                       reference_index,
                       parent_index, 
                       alias_directory, 
                       system_created
                  from v$asm_alias where group_number=1 and parent_index=16777322

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.00          0          0          0           0
Execute      1      0.00       0.00          0          0          0           0
Fetch        1      0.00       0.00          0          0          0           6
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        3      0.00       0.00          0          0          0           6

Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: SYS
Number of plan statistics captured: 1

Rows (1st) Rows (avg) Rows (max)  Row Source Operation
---------- ---------- ----------  ---------------------------------------------------
         6          6          6  FIXED TABLE FIXED INDEX X$KFALS (ind:4) (cr=0 pr=0 pw=0 time=221 us)


Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to client                       3        0.00          0.00
  SQL*Net message from client                     3      101.84        101.84
********************************************************************************

SQL ID: 8jn71z38r6h5z Plan Hash: 2683990587

select reference_index 
from
 v$asm_alias where group_number=1 and parent_index=16777322 and upper(name)=
  'USERS.259.814462681'


call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.00          0          0          0           0
Execute      1      0.00       0.00          0          0          0           0
Fetch        1      0.00       0.00          0          0          0           1
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        3      0.00       0.00          0          0          0           1

Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: SYS
Number of plan statistics captured: 1

Rows (1st) Rows (avg) Rows (max)  Row Source Operation
---------- ---------- ----------  ---------------------------------------------------
         1          1          1  FIXED TABLE FIXED INDEX X$KFALS (ind:4) (cr=0 pr=0 pw=0 time=204 us)


Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to client                       3        0.00          0.00
  SQL*Net message from client                     3        0.00          0.00
********************************************************************************

        begin
          dbms_diskgroup.getfileattr(:filename, :filetype, :filesz, :blksz);
        end;
        

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.14          0          0          0           0
Execute      1      0.01       0.42          0          0          0           1
Fetch        0      0.00       0.00          0          0          0           0
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        2      0.02       0.56          0          0          0           1

Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: SYS

Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  os thread startup                               1        0.08          0.08
  KSV master wait                                 6        0.13          0.15
  ASM file metadata operation                     2        0.00          0.00
  SQL*Net message to client                       1        0.00          0.00
  SQL*Net message from client                     1        0.00          0.00
********************************************************************************

        begin
        dbms_diskgroup.copy('', '', '', :src_path, :src_ftyp, :src_blksz, 
                            :src_fsiz, '','','', :dst_path, 1);
        end;
        

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.01          0          0          0           0
Execute      1      0.03       0.48          0          0          0           1
Fetch        0      0.00       0.00          0          0          0           0
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        2      0.03       0.50          0          0          0           1

Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: SYS

Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  KSV master wait                                 6        0.03          0.04
  ASM file metadata operation                     3        0.00          0.00
  Disk file operations I/O                        4        0.03          0.06
  dbms_file_transfer I/O                         15        0.18          0.30
  CSS initialization                              1        0.01          0.01
  CSS operation: action                           1        0.00          0.00
  SQL*Net message to client                       1        0.00          0.00
  SQL*Net message from client                     1        0.19          0.19

 

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

OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse       21      0.06       0.81          0          0          0           0
Execute     21      0.05       0.91          0          0          0           2
Fetch       19      0.03       0.46          0          0          0          25
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total       61      0.14       2.20          0          0          0          27

Misses in library cache during parse: 12
Misses in library cache during execute: 2

Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message from client                    60      387.59        669.86
  SQL*Net message to client                      59        0.00          0.00
  GCS lock cvt S                                  2        0.02          0.02
  GCS lock open S                                10        0.03          0.05
  Disk file operations I/O                        8        0.03          0.07
  kfk: async disk IO                             14        0.00          0.01
  library cache lock                              1        0.03          0.03
  library cache pin                               1        0.00          0.00
  os thread startup                               1        0.08          0.08
  KSV master wait                                12        0.13          0.20
  ASM file metadata operation                     5        0.00          0.00
  dbms_file_transfer I/O                         15        0.18          0.30
  CSS initialization                              1        0.01          0.01
  CSS operation: action                           1        0.00          0.00


OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        2      0.00       0.12          0          0          0           0
Execute      0      0.00       0.00          0          0          0           0
Fetch        0      0.00       0.00          0          0          0           0
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        2      0.00       0.12          0          0          0           0

Misses in library cache during parse: 2

   21  user  SQL statements in session.
    2  internal SQL statements in session.
   23  SQL statements in session.
********************************************************************************
Trace file: /u01/app/grid/diag/asm/+asm/+ASM1/trace/+ASM1_ora_4742.trc
Trace file compatibility: 11.1.0.7
Sort options: default

       1  session in tracefile.
      21  user  SQL statements in trace file.
       2  internal SQL statements in trace file.
      23  SQL statements in trace file.
      14  unique SQL statements in trace file.
   41120  lines in trace file.
     284  elapsed seconds in trace file.


发表在 ASM | 标签为 , , | 留下评论

模拟ORA-600 [4000] 并修复

我没有测试,但是我感觉,从一个好的库上直接dd一个file 1 block 520,可能也可以的,O(∩_∩)O哈哈~
我这里使用了bbed去修改文件,生产库请勿效仿,后果自负 :)
模拟ORA-600 [4000]:

SYS@bb>Alter session set events '10912 trace name context forever, level 1';

Session altered.

SYS@bb>exec dbms_space_admin.tablespace_fix_segment_extblks('SYSTEM');

PL/SQL procedure successfully completed.

SYS@bb>shutdown abort
ORACLE instance shut down.
SYS@bb>startup
ORACLE instance started.

Total System Global Area  367439872 bytes
Fixed Size                  2228464 bytes
Variable Size             134221584 bytes
Database Buffers          226492416 bytes
Redo Buffers                4497408 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-00600: internal error code, arguments: [4000], [3], [], [], [], [], [], [], [], [], [], []
Process ID: 15101
Session ID: 125 Serial number: 5


SYS@bb>

查看alert:

SMON: enabling cache recovery
Errors in file /u01/app/oracle/diag/rdbms/bb/bb/trace/bb_ora_15101.trc  (incident=14537):
ORA-00600: internal error code, arguments: [4000], [3], [], [], [], [], [], [], [], [], [], []
Incident details in: /u01/app/oracle/diag/rdbms/bb/bb/incident/incdir_14537/bb_ora_15101_i14537.trc
Use ADRCI or Support Workbench to package the incident.
See Note 411.1 at My Oracle Support for error and packaging details.
Errors in file /u01/app/oracle/diag/rdbms/bb/bb/trace/bb_ora_15101.trc:
ORA-00704: bootstrap process failure
ORA-00600: internal error code, arguments: [4000], [3], [], [], [], [], [], [], [], [], [], []
Errors in file /u01/app/oracle/diag/rdbms/bb/bb/trace/bb_ora_15101.trc:
ORA-00704: bootstrap process failure
ORA-00600: internal error code, arguments: [4000], [3], [], [], [], [], [], [], [], [], [], []
Error 704 happened during db open, shutting down database
USER (ospid: 15101): terminating the instance due to error 704
Instance terminated by USER, pid = 15101
ORA-1092 signalled during: ALTER DATABASE OPEN...
opiodr aborting process unknown ospid (15101) as a result of ORA-1092
Sun Oct 27 21:55:58 2013
ORA-1092 : opitsk aborting process

查看trace:

[root@lunar ~]# vi /u01/app/oracle/diag/rdbms/bb/bb/trace/bb_ora_15101.trc
Trace file /u01/app/oracle/diag/rdbms/bb/bb/trace/bb_ora_15101.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning and Real Application Testing options
ORACLE_HOME = /u01/app/oracle/product/11.2.0.3/dbhome_1
System name:    Linux
Node name:      lunar
Release:        2.6.32-300.10.1.el5uek
Version:        #1 SMP Wed Feb 22 17:37:40 EST 2012
Machine:        x86_64
Instance name: bb
Redo thread mounted by this instance: 1
Oracle process number: 17
Unix process pid: 15101, image: oracle@lunar (TNS V1-V3)


*** 2013-10-27 21:55:50.765
*** SESSION ID:(125.5) 2013-10-27 21:55:50.765
*** CLIENT ID:() 2013-10-27 21:55:50.765
*** SERVICE NAME:() 2013-10-27 21:55:50.765
*** MODULE NAME:(sqlplus@lunar (TNS V1-V3)) 2013-10-27 21:55:50.765
*** ACTION NAME:() 2013-10-27 21:55:50.765

Successfully allocated 2 recovery slaves
Using 67 overflow buffers per recovery slave
Thread 1 checkpoint: logseq 35, block 2, scn 577686
  cache-low rba: logseq 35, block 375
    on-disk rba: logseq 35, block 3679, scn 582875
  start recovery at logseq 35, block 375, scn 0

*** 2013-10-27 21:55:50.776
"/u01/app/oracle/diag/rdbms/bb/bb/trace/bb_ora_15101.trc" 85L, 3189C
KCRA: blocks processed = 1733/1733, claimed = 1733, eliminated = 0

*** 2013-10-27 21:55:50.839
Recovery of Online Redo Log: Thread 1 Group 2 Seq 35 Reading mem 0

*** 2013-10-27 21:55:50.856
Completed redo application of 1.23MB

*** 2013-10-27 21:55:52.664
Completed recovery checkpoint
----- Recovery Hash Table Statistics ---------
Hash table buckets = 262144
Longest hash chain = 1
Average hash chain = 1733/1733 = 1.0
Max compares per lookup = 1
Avg compares per lookup = 11220/11234 = 1.0
----------------------------------------------
Recovery sets nab of thread 1 seq 35 to 3679 with 8 zeroblks

*** 2013-10-27 21:55:54.685
Incident 14537 created, dump file: /u01/app/oracle/diag/rdbms/bb/bb/incident/incdir_14537/bb_ora_15101_i14537.trc
ORA-00600: internal error code, arguments: [4000], [3], [], [], [], [], [], [], [], [], [], []

ORA-00704: bootstrap process failure
ORA-00600: internal error code, arguments: [4000], [3], [], [], [], [], [], [], [], [], [], []
ORA-00704: bootstrap process failure
ORA-00600: internal error code, arguments: [4000], [3], [], [], [], [], [], [], [], [], [], []

*** 2013-10-27 21:55:56.922
USER (ospid: 15101): terminating the instance due to error 704
[root@lunar ~]# 


dbkedDefDump(): Starting incident default dumps (flags=0x2, level=3, mask=0x0)
----- Current SQL Statement for this session (sql_id=6apq2rjyxmxpj) -----
select line#, sql_text from bootstrap$ where obj# != :1  ===========注意这个是当前报错的语句,注意到是bootstrap$


SYS@bb>startup restrict pfile=/tmp/a.ora
ORACLE instance started.

Total System Global Area  367439872 bytes
Fixed Size                  2228464 bytes
Variable Size             134221584 bytes
Database Buffers          226492416 bytes
Redo Buffers                4497408 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-00600: internal error code, arguments: [4000], [3], [], [], [], [], [], [], [], [], [], []
Process ID: 15215
Session ID: 125 Serial number: 5


SYS@bb>

trace中其他有用的信息如下:

PINNED BUFFER HISTORY (oldest pin first)
---------------------
BH (0x6dfea308) file#: 1 rdba: 0x00400208 (1/520) class: 4 ba: 0x6ddec000
  set: 6 pool: 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 0,0
  dbwrid: 0 obj: 59 objn: 59 tsn: 0 afn: 1 hint: f
  hash: [0x6dffc6a8,0x74bda248] lru: [0x745e01f8,0x745e01f8]
  ckptq: [NULL] fileq: [NULL] objq: [0x70c773a8,0x70c773a8] objaq: [0x70c77398,0x70c77398]
  st: XCURRENT md: NULL fpin: 'ktewh25: kteinicnt' tch: 1
  flags:
  LRBA: [0x0.0.0] LSCN: [0x0.0] HSCN: [0xffff.ffffffff] HSUB: [65535]
  buffer tsn: 0 rdba: 0x00400208 (1/520)
  scn: 0x0000.0008d28a seq: 0x01 flg: 0x04 tail: 0xd28a1001
  frmt: 0x02 chkval: 0xe5c5 type: 0x10=DATA SEGMENT HEADER - UNLIMITED
Hex dump of block: st=0, typ_found=1

。。。。。。。。。。。。。。。。。。。。。。。。。。。。。


  Extent Control Header
  -----------------------------------------------------------------
  Extent Header:: spare1: 0      spare2: 0      #extents: 1      #blocks: 7
                  last map  0x00000000  #maps: 0      offset: 4128
      Highwater::  0x0040020c  ext#: 0      blk#: 3      ext size: 7
  #blocks in seg. hdr's freelists: 1
  #blocks below: 3
  mapblk  0x00000000  offset: 0
      Disk Lock:: Locked by xid:  0x0003.00c.00000180           注意这里,有一个事物,这个表被加了锁
     Map Header:: next  0x00000000  #extents: 1    obj#: 59     flag: 0x40000000
  Extent Map
  -----------------------------------------------------------------
   0x00400209  length: 7
 
  nfl = 1, nfb = 1 typ = 1 nxf = 0 ccnt = 3
  SEG LST:: flg: USED   lhd: 0x0040020b ltl: 0x0040020b
BH (0x6dffc5f8) file#: 1 rdba: 0x00400208 (1/520) class: 4 ba: 0x6dfd6000
  set: 5 pool: 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 0,0
  dbwrid: 0 obj: -2 objn: -1 tsn: 0 afn: 1 hint: f
  hash: [0x74bda248,0x6dfea3b8] lru: [0x745dfaf8,0x745dfaf8]
  ckptq: [NULL] fileq: [NULL] objq: [NULL] objaq: [NULL]
  st: CR md: NULL tch: 1
  cr: [scn: 0x0.1],[xid: 0x0.0.0],[uba: 0x0.0.0],[cls: 0x0.ab9bb],[sfl: 0x0],[lc: 0x0.0]
  flags:
  buffer tsn: 0 rdba: 0x00400208 (1/520)
  scn: 0x0000.0008d28a seq: 0x01 flg: 0x04 tail: 0xd28a1001
  frmt: 0x02 chkval: 0xe5c5 type: 0x10=DATA SEGMENT HEADER - UNLIMITED
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x000000006DFD6000 to 0x000000006DFD8000
06DFD6000 0000A210 00400208 0008D28A 04010000  [......@.........]


。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

  Extent Control Header
  -----------------------------------------------------------------
  Extent Header:: spare1: 0      spare2: 0      #extents: 1      #blocks: 7
                  last map  0x00000000  #maps: 0      offset: 4128
      Highwater::  0x0040020c  ext#: 0      blk#: 3      ext size: 7
  #blocks in seg. hdr's freelists: 1
  #blocks below: 3
  mapblk  0x00000000  offset: 0
      Disk Lock:: Locked by xid:  0x0003.00c.00000180  
     Map Header:: next  0x00000000  #extents: 1    obj#: 59     flag: 0x40000000
  Extent Map
  -----------------------------------------------------------------
   0x00400209  length: 7

  nfl = 1, nfb = 1 typ = 1 nxf = 0 ccnt = 3
  SEG LST:: flg: USED   lhd: 0x0040020b ltl: 0x0040020b

The buffer with tsn: 0 rdba: 0x00400208 has already been dumped

摘要上面的信息,有用的如下:

rdba: 0x00400208 (1/520)  =============》说明root dba是file 1 block 520
Extent Header:: spare1: 0      spare2: 0      #extents: 1      #blocks: 7
Disk Lock:: Locked by xid:  0x0003.00c.00000180      ==============》被锁的事物的xid,转换成10进制是:3.12.384 ,这里跟报错信息匹配了,是回滚段3,事物槽是12,wrap是384
obj#: 59
  scn: 0x0000.0008d28a seq: 0x01 flg: 0x04 tail: 0xd28a1001

obj# 59是 bootstrap$表

下面清除锁标识:

[oracle@lunar bbed]$ bbed parfile=bbed.par

BBED: Release 2.0.0.0.0 - Limited Production on Sun Oct 27 23:17:33 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED> set file 1 block 520
        FILE#           1
        BLOCK#          520

BBED> 
BBED> set offset 88
        OFFSET          88
BBED> m /x 00000000
 File: /u01/app/oracle/oradata/bb/system01.dbf (1)
 Block: 520              Offsets:   88 to  599           Dba:0x00400208
------------------------------------------------------------------------
 00000000 01000000 00000000 3b000000 00000040 09024000 07000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 <32 bytes per line>

BBED> sum apply
Check value for File 1, Block 520:
current = 0xe5c4, required = 0xe5c4

BBED> 

成功打开数据库:

[oracle@lunar trace]$ ss

SQL*Plus: Release 11.2.0.3.0 Production on Sun Oct 27 23:30:54 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning and Real Application Testing options

SYS@bb>alter database open;

Database altered.

SYS@bb>archive log list
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            /u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/arch
Oldest online log sequence     41
Current log sequence           43
SYS@bb>
发表在 backup&recovery, ORA-600/7445 | 标签为 , | 4 条评论

关于Oracle的版本号

昨天Roger问小朋友们,谁能说清楚Oracle的版本号,我想起来了,不同版本稍有区别,在Oracle官方文档有详细的解释。
 
在Oracle 7版本,Oracle版本号包含4部分内容,这个风格(或者说“定义”)一直沿用到Oracle 8i(即,Oracle 8.1.5),这四部分具体解释如下:

0

第一部分是“Version Number",也就是产品的大版本号,表示这是一个“新的软件”,较之以前的版本有着重大的功能的变革。
 
第二部分是“Maintenance Release Number”,即 维护版本,也就是大版本下的普通的维护号,旨在标识不同维护版本之间修复了一些重要bug等等。Oracle 7,8.9这三个版本的维护号都是从0开始的,从Oracle 10g开始,Oracle不再有类似Oracle 10.0这样的正式发布版本(internal测试版还有这样的版本),而是10.1,10.2。。。。。
 
第三部分是“Patch Release Number”,顾名思义,也就是补丁发布号。
Oracle的产品研发是有计划展开的,因此,通常来说当前一个维护版本中出现一些重大问题,等不到下一个维护版号release,
那么就推出了统一维护版本下的更高patch号的版本,用以修复之前的重大bug。这个版本号在Oracle 7和8中式最常见的。
从Oracle 8i(Oracle 8.1.5)开始,Oracle将第三个数字的含义修改为“Maintenance Release Number”,
也就是说这个数字表示一个维护级别,比如,Oracle 8.1.5, 8.1.6, 8.1.7各自增加了一些新的new feature,
这也突出了那个时候Oracle定位产品和方向的一个研发的特点。。。
 
第四部分是“Port-Specific Patch Release Number”,即特定补丁号的版本,其含义是针对某些特定重要问题或者bug的修复,也就是在“Patch Release Number”没有release之前的一个特定针对特定问题的补丁号。
 
 
从Oracle 8i(“i” 表示internet,那一年internet正蔓延。。。)开始,发行版本号包含5个部分,虽然从这以后的Oracle版本号都是5个部分,但是Oracle 8i的这5个部分跟其余的版本的解释都不相同,我想这跟当时的很多市场定位,IT环境都有关系。
从这一个版本开始,在第1个数字和第2个数字之间,增加了一个数字,表示“New Features Release Number”,自然,Oracle将在这一个版本中大展拳脚,不断充实自己,开发出了很错脍炙人口的大大小小的新功能,比如 Oracle是第一个Java数据库,也是从Oracle 8i这个版本开始,Oracle有了机遇图形化的安装工具,standby 功能可以自动传输归档,oracle的OPS开始具有了Cache Fusion功能,从这个版本开始有了Logmner,Net8具有了更多类似ssh等安全功能,从这一版本开始Oracle有了第一个压缩的功能“index key compress”。。。。。。
因此,这个名称起得当之无愧,寓意着Oracle 8和Oracle 8i确实是两个不同的产品。
从Oracle 8i开始,最后两位数字的含义也发生了变化,即分别是“Generic Patch Set Number”和“Platform Specific Patch Set Number”,但是含义跟以前的4位数字表示的后两位大体一致。

0.1

从Oracle 9.2开始,版号的5个部分含义再次更正为如下解释,且这5个部分的大体含义至今再无改变,只有第三个数字的含义随着Oracle的市场收购和产品线的定位做了些许更改。
当时Oracle已经开始研发自己的application server产品(例如,大名鼎鼎的Application 11i等等),因此,从Oracle 9i开始,Oracle把这五个数字再次重新定位具体如下:
第1个数字,更名为“Major Database Release Number”,但是依然是代表大版本号,且含义不变
第2个数字,就是把Oracle 8i中第二个数字和第三个数字(“New Features Release Number”和“Maintenance Release Number”)合并为“Database Maintenance Release Number”,含义自然是新特性和重要bug合并的数据库维护号,而事实上,Oracle 从8i开始就逐步统一数据库内部各个组件和选件的版本号,比如PLSQL和DATABASE SEVER的版本号都是8.1.5,而不是以前的各自的版本号。。。
第3个数字,是新增加的“Application Server Release Number”,很明显就是专门为Oracle9i Application Server (Oracle9iAS)增加的版本号
第4个数字,更名为“Component Specific Release Number”,这里多了Component一词,也是因为不再是database了,开始增加了各个领域的产品,但是含义依然是以前的重大bug的修复的中间patch的含义。
第5个数字,没有变化,依然是“Platform Specific Release Number”
顺便说一句,很多朋友不知道Oracle 9开始发布的第一个版本是Oracle 9.0.1而不是9.1,从Oracle 9.0.1之后,推出的9i的主流版本9.2。

6

Oracle 10g和Oracle 9.2的版本号的命名没有大的区别:
1

从Oracle 11.2开始,随着Oracle产品线的调整,第三个数字再次发生了改变,即从以前的“Application Server Release Numbe”更名为“Fusion Middleware Release Number”,也是是Oracle自2008年收购BEA之后的第一个重要版本,自然是要大融合,O(∩_∩)O哈哈~,其实含义差不多
Oracle收购了BEA之后,放下了自己的iAS,大举推广BEA旗下的更为小巧轻便有前途的Weblogic server(针对java)和Tuxedo(针对C)等全线产品。。。

2

3

顺便说一句,Oracle database不同部件有各自的版本号,例如:
SVRMGR> SELECT * FROM product_component_version;
PRODUCT                    VERSION             STATUS
-------------------------- ------------------- ------------
CORE                       3.4.1.0.0           Production
NLSRTL                     3.1.3.0.0           Production
Oracle7 Server             7.2.1.0.0           Beta Release
PL/SQL                     2.2.1.0.0           Beta
TNS for SunOS:             2.1.4.0.0           Production
5 rows selected.
 
SELECT * FROM product_component_version;
 
PRODUCT                       VERSION                     STATUS
---------------------------   --------------------------- ---------------------
CORE                          8.1.5.0.0                   Production
NLSRTL                        3.4.0.0.0                   Production
Oracle8i Enterprise Edition   8.1.5.0.0                   Production
PL/SQL                        8.1.5.0.0                   Production
TNS for 32-bit Windows:       8.1.5.0.0                   Production
5 rows selected.
 
COL PRODUCT FORMAT A40
COL VERSION FORMAT A15
COL STATUS FORMAT A15 
SELECT * FROM PRODUCT_COMPONENT_VERSION;
 
PRODUCT                                  VERSION     STATUS
---------------------------------------- ----------- -----------
NLSRTL                                   12.1.0.0.1  Production
Oracle Database 12c Enterprise Edition   12.1.0.0.1  Production
PL/SQL                                   12.1.0.0.1  Production
...
发表在 FAQ | 标签为 , | 留下评论

使用exp+pipe将导出文件生成压缩包(文本数据的话,空间通常节省10倍左右)

有时候我们的存储空间不够,一个exp会产生一个很大的dmp文件,因此,我们就像exp的时候直接生成一个压缩包,那么管道就可以派上用场了,O(∩_∩)O哈哈~

10g以后,可以使用expdp compression,例如:

[oracle@lunar ~]$ expdp lunar/lunar file=expdp_ff.dmp compression=all tables=ff
 
Export: Release 11.2.0.3.0 - Production on Sun Oct 27 01:48:15 2013
 
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
 
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning and Real Application Testing options
Legacy Mode Active due to the following parameters:
Legacy Mode Parameter: "file=expdp_ff.dmp" Location: Command Line, Replaced with: "dumpfile=expdp_ff.dmp"
Legacy Mode has set reuse_dumpfiles=true parameter.
Legacy Mode has set nologfile=true parameter.
Starting "LUNAR"."SYS_EXPORT_TABLE_01":  lunar/******** dumpfile=expdp_ff.dmp compression=all tables=ff reuse_dumpfiles=true nologfile=true 
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 15 MB
Processing object type TABLE_EXPORT/TABLE/TABLE
. . exported "LUNAR"."FF"                                1.678 MB  141112 rows
Master table "LUNAR"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for LUNAR.SYS_EXPORT_TABLE_01 is:
  /u01/app/oracle/admin/travel/dpdump/expdp_ff.dmp
Job "LUNAR"."SYS_EXPORT_TABLE_01" successfully completed at 01:48:24
 
[oracle@lunar ~]$

10g以前,就3条命令搞定:

mknod /tmp/exp_pipe p
compress < /tmp/exp_pipe > exp_full.dmp.Z &
exp lunar/lunar file=/tmp/exp_pipe log=exp_full.log full=y

主意,linux里面可以使用gzip的,貌似compress需要单独安装,unix里面直接有compress

mknod /tmp/exp_pipe p
gzip < /tmp/exp_pipe > exp_full.dmp.Z &
exp lunar/lunar file=/tmp/exp_pipe log=exp_full.log full=y

使用gzip的例子:

[oracle@lunar ~]$ ll
total 14964
-rw-r--r-- 1 oracle oinstall 15286272 Oct 27 01:11 ff.dmp
-rw-r--r-- 1 oracle oinstall     1165 Oct 26 22:15 filelist.txt
-rw-r--r-- 1 oracle oinstall      229 Oct 26 22:14 log.bbd
drwxr-xr-x 7 oracle oinstall     4096 Oct 27 00:35 test
-rw-r--r-- 1 oracle oinstall      469 Feb  8  2013 travel.env
[oracle@lunar ~]$ 
[oracle@lunar ~]$ 
[oracle@lunar ~]$ gzip < /tmp/exp_pipe > exp_ff.dmp.Z &
[1] 13619
[oracle@lunar ~]$ exp lunar/lunar file=/tmp/exp_pipe log=exp_ff.log tables=ff
 
Export: Release 11.2.0.3.0 - Production on Sun Oct 27 01:37:57 2013
 
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
 
 
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning and Real Application Testing options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion)
 
About to export specified tables via Conventional Path ...
. . exporting table                             FF     141112 rows exported
Export terminated successfully without warnings.
[oracle@lunar ~]$ ll
total 16604
-rw-r--r-- 1 oracle oinstall  1667612 Oct 27 01:37 exp_ff.dmp.Z
-rw-r--r-- 1 oracle oinstall      473 Oct 27 01:37 exp_ff.log
-rw-r--r-- 1 oracle oinstall 15286272 Oct 27 01:11 ff.dmp
-rw-r--r-- 1 oracle oinstall     1165 Oct 26 22:15 filelist.txt
-rw-r--r-- 1 oracle oinstall      229 Oct 26 22:14 log.bbd
drwxr-xr-x 7 oracle oinstall     4096 Oct 27 00:35 test
-rw-r--r-- 1 oracle oinstall      469 Feb  8  2013 travel.env
[1]+  Done                    gzip < /tmp/exp_pipe > exp_ff.dmp.Z
[oracle@lunar ~]$

可以看到大概15倍的压缩比,O(∩_∩)O哈哈~

使用compress的例子:

 
[oracle@ts01 tmp]$ mknod /tmp/exp_pipe p
[oracle@ts01 tmp]$ ls -l /tmp/exp_pipe
prw-r--r--    1 oracle   oinstall        0 Mar 16 12:05 /tmp/exp_pipe
[oracle@ts01 tmp]$ compress < /tmp/exp_pipe > exp_full.dmp.Z &
[1] 9099
[oracle@ts01 tmp]$ 
[oracle@ts01 tmp]$ jobs
[1]+  Running                 compress </tmp/exp_pipe >exp_full.dmp.Z &
[oracle@ts01 tmp]$ ls -lrt
total 0
[oracle@ts01 tmp]$ ls -lrt
total 0
[oracle@ts01 tmp]$ exp lunar/lunar file=/tmp/exp_pipe log=exp_full.log
 
Export: Release 9.2.0.6.0 - Production on Thu Mar 16 12:06:10 2006
 
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
 
 
Connected to: Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses ZHS16GBK character set (possible charset conversion)
 
About to export specified users ...
. exporting pre-schema procedural objects and actions
EXP-00008: ORACLE error 4068 encountered
ORA-04068: existing state of packages has been discarded
ORA-04063: package body "SYS.LT_EXPORT_PKG" has errors
ORA-06508: PL/SQL: could not find program unit being called
ORA-06512: at line 1
EXP-00083: The previous problem occurred when calling SYS.LT_EXPORT_PKG.schema_info_exp
. exporting foreign function library names for user LUNAR 
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user LUNAR 
About to export LUNAR's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export LUNAR's tables via Conventional Path ...
. . exporting table                           BBED          2 rows exported
. . exporting table                      BIG_TABLE    1000000 rows exported
. . exporting table                          BONUS          0 rows exported
. . exporting table                           DEPT          4 rows exported
. . exporting table                          DUMMY          1 rows exported
. . exporting table                            EMP         14 rows exported
. . exporting table                     LUNAR_TEST          1 rows exported
. . exporting table                      RUN_STATS
. . exporting table                       SALGRADE          5 rows exported
. . exporting table           SUBSCRIPTION_HISTORY
. . exporting partition                     SUBNHIS_P1       1664 rows exported
. . exporting partition                     SUBNHIS_P2       1792 rows exported
. . exporting partition                     SUBNHIS_P3       1978 rows exported
. . exporting partition                     SUBNHIS_P4       1890 rows exported
. . exporting partition                     SUBNHIS_P5       1980 rows exported
. . exporting partition                     SUBNHIS_P6       1920 rows exported
. . exporting partition                     SUBNHIS_P7       1984 rows exported
. . exporting partition                     SUBNHIS_P8       1984 rows exported
. . exporting partition                     SUBNHIS_P9       1920 rows exported
. . exporting partition                    SUBNHIS_P10       1984 rows exported
. . exporting partition                    SUBNHIS_P11       1920 rows exported
. . exporting partition                    SUBNHIS_P12       1984 rows exported
. . exporting table                              T      20000 rows exported
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
EXP-00008: ORACLE error 4068 encountered
ORA-04068: existing state of packages has been discarded
ORA-04063: package body "SYS.LT_EXPORT_PKG" has errors
ORA-06508: PL/SQL: could not find program unit being called
ORA-06512: at line 1
EXP-00083: The previous problem occurred when calling SYS.LT_EXPORT_PKG.schema_info_exp
. exporting statistics
Export terminated successfully with warnings.
[oracle@ts01 tmp]$
[oracle@ts01 tmp]$ ls -lrt
total 28488
-rw-r--r--    1 oracle   oinstall     3684 Mar 16 12:06 exp_full.log
-rw-r--r--    1 oracle   oinstall 29133046 Mar 16 12:06 exp_full.dmp.Z
[1]+  Done                    compress </tmp/exp_pipe >exp_full.dmp.Z
[oracle@ts01 tmp]$ 
[oracle@ts01 tmp]$ 
[oracle@ts01 tmp]$ ls -lrt
total 28488
-rw-r--r--    1 oracle   oinstall     3684 Mar 16 12:06 exp_full.log
-rw-r--r--    1 oracle   oinstall 29133046 Mar 16 12:06 exp_full.dmp.Z
[oracle@ts01 tmp]$
发表在 expdp/impdp, FAQ | 标签为 , , | 留下评论

使用exp+pipe的方式直接将数据库导出到目标数据库(数据不落地成dmp)

最早在oracle 8,Oracle 8i,Oracle 9i的时候,没有datapump,因此逻辑数据库迁移的工作多依赖于exp/imp,
然而,当磁盘空间有限制,且停机时间短的时候,通常我们需要一种方式是数据不落地。

那时候,我们常用方式就是借助于管道,也就是exp将数据库导出到pipe,目标段通过管道直接将数据imp到目标数据库,这样数据时不落地的,省去了生成dmp文件的时间和空间,O(∩_∩)O哈哈~

当然,类似应用还有很多,比如可以使用管道直接讲exp的数据存储到tape,或者直接exp的数据导出成压缩格式,后面会一次测试。

这里先测试,exp to pipe and imp from pipe:

[oracle@lunar exp-pipe]$ mknod /tmp/exp_pipe p
[oracle@lunar exp-pipe]$
[oracle@lunar exp-pipe]$ ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:43:8D:35
inet addr:192.168.56.66 Bcast:192.168.56.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe43:8d35/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5971 errors:0 dropped:0 overruns:0 frame:0
TX packets:4147 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:555804 (542.7 KiB) TX bytes:550356 (537.4 KiB)
[oracle@lunar imp_pipe]$ mknod /tmp/imp_pipe p
[oracle@lunar imp_pipe]$
[oracle@lunar imp_pipe]$ ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:F1:72:D0
inet addr:192.168.56.101 Bcast:192.168.56.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fef1:72d0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5444 errors:0 dropped:0 overruns:0 frame:0
TX packets:4332 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:489891 (478.4 KiB) TX bytes:366032 (357.4 KiB)

使用oracle安装包的ssh脚本配置两个机器的互信,超简单,这里不赘述

然后在第一个窗口输入:

[oracle@lunar ~]$ dd if=/tmp/exp_pipe | ssh 192.168.56.101 dd of=/tmp/imp_pipe
。。。。

这里会停在这个界面,等待管道的输入
然后再开一个session,使用exp讲数据库输入到管道中:

[oracle@lunar ~]$ exp lunar/lunar file=/tmp/exp_pipe log=ff.log tables=ff
 
Export: Release 11.2.0.3.0 - Production on Sun Oct 27 00:48:17 2013
 
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning and Real Application Testing options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion)
 
About to export specified tables via Conventional Path ...
. . exporting table FF
 
。。。。。。。。。

这个界面会等待目标段接收。。。。。
然后在目标段开启一个会话:

[oracle@lunar imp_pipe]$ imp lunar/lunar file=/tmp/imp_pipe log=ff.log tables=ff
 
Import: Release 11.2.0.3.0 - Production on Sun Oct 27 16:48:11 2013
 
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning and Real Application Testing options
 
Export file created by EXPORT:V11.02.00 via conventional path
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
. importing LUNAR's objects into LUNAR
. importing LUNAR's objects into LUNAR
. . importing table "FF" 141112 rows imported
Import terminated successfully without warnings.
[oracle@lunar imp_pipe]$

然后可以看到,数据传输完成时,其他会话都完成了:

[oracle@lunar ~]$ dd if=/tmp/exp_pipe | ssh 192.168.56.101 dd of=/tmp/imp_pipe
29856+0 records in
29856+0 records out
15286272 bytes (15 MB) copied, 61.7143 seconds, 248 kB/s
29856+0 records in
29856+0 records out
15286272 bytes (15 MB) copied, 3.78268 seconds, 4.0 MB/s
[oracle@lunar ~]$
 
[oracle@lunar ~]$ exp lunar/lunar file=/tmp/exp_pipe log=ff.log tables=ff
 
Export: Release 11.2.0.3.0 - Production on Sun Oct 27 00:48:17 2013
 
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning and Real Application Testing options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion)
 
About to export specified tables via Conventional Path ...
. . exporting table FF 141112 rows exported
Export terminated successfully without warnings.
[oracle@lunar ~]$

现在在目标段查看表是否已经被导入了:

[oracle@lunar imp_pipe]$ ss
 
SQL*Plus: Release 11.2.0.3.0 Production on Sun Oct 27 16:51:13 2013
 
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning and Real Application Testing options
 
SYS@bb>conn lunar/lunar
Connected.
LUNAR@bb>select count(*) from ff;
 
COUNT(*)
----------
141112
 
LUNAR@bb>

O(∩_∩)O哈哈~,搞定!

发表在 expdp/impdp, FAQ | 标签为 , , | 留下评论