分类 默认分类 下的文章

安装Grid时,执行root.sh之前,在两个节点都打上补丁,再运行root.sh
补丁:18370031 (补丁要mos管方账号才能下)
$ /u01/app/11.2.0/grid/OPatch/opatch apply -local

现象:
Grid 11.2.0.4 Install fails when running root.sh on OL7, this affects both Oracle Clusterware and Oracle Restart Installation.

rootcrs.log/roothas.log confirms that ohasd/crsd failed to start

原因:

There is a known issue where OL7 expects to use systemd rather than initd for running processes and restarting them and root.sh does not handle this currently.

This was reported in the following Unpublished Bug

  Bug 18370031  - RC SCRIPTS (/ETC/RC.D/RC.* , /ETC/INIT.D/* ) ON OL7 FOR LUSTERWARE

解决办法:

Because Oracle Linux 7 (and Redhat 7) use systemd rather than initd for starting/restarting processes and runs them as a service the current software install of both 11.2.0.4 & 12.1.0.1 will not succeed because the ohasd process does not start properly.
In OL7 it needs to be set up as a service and patch fix for Bug 18370031 needs to be applied for this , BEFORE you run root.sh when prompted .

Need to apply the patch 18370031 for 11.2.0.4 .
And also its mentioned in 11gR2 Release Notes:https://docs.oracle.com/cd/E11882_01/relnotes.112/e23558/toc.htm#CJAJEBGG
During the Oracle Grid Infrastructure installation, you must apply patch 18370031 before configuring the software that is installed.
The timing of applying the patch is important and is described in detail in the Note 1951613.1 on My Oracle Support. This patch ensures that
the clusterware stack is configured to use systemd for clusterware processes, as Oracle Linux 7 uses systemd for all services.

  1. 进入debug模式

    perl -d p.pl

  2. 查看第几行代码

    l 10

查看函数代码

l 函数名
  1. 在函数f1上设置断点

    b f1

  2. 在指定44行设置断定

    b 44

  3. 查看所有断点

    L

  4. 单步调试,s进入调用函数,n直接下一语句不进入调用函数

    s
    n

7.继续直到指定的行

c 36

8.打印变量值

print $a

下载DBD-Oracle-1.80.tar.gz,地址如下:

https://metacpan.org/pod/DBD::Oracle

解压DBD-Oracle-1.80.tar.gz到/tmp下

在root用户添加如下环境变量:

 export ORACLE_BASE=/home/db/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0
export GRID_HOME=/home/db/grid/product/11.2.0
export LD_LIBRARY_PATH=:$ORACLE_HOME/lib:$ORACLE_HOME/lib32
export LIBPATH=$LD_LIBRARY_PATH
export   PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$GRID_HOME/bin:/usr/bin:/etc:/usr/sbin:

安装:

cd /tmp/DBD-Oracle-1.80
perl Makefile.PL
make
make install

测试perl访问oracle:

  #!/usr/bin/perl  
use DBI;  
$dbh = DBI->connect("dbi:Oracle:testdb", "system", "oracle") or die("DB connect error!\n");  
$sql = "select * from dual";  
$sth = $dbh->prepare($sql);  
$sth->execute() or die("error!");  
while(@rows = $sth->fetchrow_array)  
{  
        foreach(@rows)  
        {  
                print "$_\t";  
        }  
        print "\n";  
}  
$sth->finish;  

显示'x'说明ok

select(index, ...)

如果index是正数,那么返回从左边第index个到最右边的参数;
如果index是负数,那么返回从右边第index个到最左边的参数;
如果index是字符串"#", 那么返回可变参数...的参数个数
例如:

function test(...)
    print(select("#", ...))
    -- 输出为:
    -- 4

    for i=1, select("#", ...) do
        print(select(i, ...))
    end
    -- 输出为:
    -- 1    2    3    4
    -- 2    3    4
    -- 3    4
    -- 4

    for i=1, select("#", ...) do
        print(select(-i, ...))
    end
    -- 输出为:
    -- 4
    -- 3    4
    -- 2    3    4
    -- 1    2    3    4
end

test(1, 2, 3, 4)

ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction

information_schema库中有三个关于锁的表:

  • innodb_trx ## 当前运行的所有事务
  • innodb_locks ## 当前出现的锁
  • innodb_lock_waits ## 锁等待的对应关系

解决办法

select * from information_schema.innodb_trx;
select * from information_schema.innodb_locks;
select * from information_schema.innodb_lock_waits;
-- 找到一直没有提交的事务
kill <trx_mysql_thread_id>