Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖

0

积分

1

好友

3

主题
1#
发表于 2013-9-16 16:37:34 | 查看: 4519| 回复: 3
在网上搜了一些资料,说文件lk$ORACLE_SID的作用是用于操作系统锁定数据库,不懂这是什么意思,请高人指点。谢谢。
2#
发表于 2013-9-25 20:40:17
你做一个实验就明白了

同时开2个sqlplus  对于一个未启动的实例,然后在同一时刻拍入startup;


sqlplus 1:

SQL> startup;
ORACLE instance started.

Total System Global Area 1224736768 bytes
Fixed Size                  2095896 bytes
Variable Size             503317736 bytes
Database Buffers          704643072 bytes
Redo Buffers               14680064 bytes
Database mounted.
Database opened.


sqlplus 2:

[oracle@vrh8 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Wed Sep 25 20:37:59 2013

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> startup;
ORA-10997: another startup/shutdown operation of this instance inprogress
ORA-09968: unable to lock file
Linux-x86_64 Error: 11: Resource temporarily unavailable
Additional information: 17416



由于在startup nomount的过程中 shm共享内存和共享的信号都未建立,所以同时startup可能会启动2套实例,为了解决这个问题,使用lk$ORACLE_SID这个文件,谁先锁住这个文件 就可以继续后面startup nomount的过程

回复 只看该作者 道具 举报

3#
发表于 2013-9-25 20:42:37
第二个sqlplus 的 strace 内容如下:



umask(0)                                = 022
open("/s01/oracle/product/10.2.0.5/db_1/dbs/lkinstG10R25", O_RDWR|O_CREAT|O_EXCL, 0660) = -1 EEXIST (File exists)
open("/s01/oracle/product/10.2.0.5/db_1/dbs/lkinstG10R25", O_RDWR) = 7
umask(022)                              = 0
fcntl(7, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = -1 EAGAIN (Resource temporarily unavailable)
times(NULL)                             = 744842024

close(6)                                = 0
open("/s01/admin/G10R25/bdump/alert_G10R25.log", O_WRONLY|O_CREAT|O_APPEND, 0660) = 6
gettimeofday({1380112868, 403281}, NULL) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=405, ...}) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=405, ...}) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=405, ...}) = 0
writev(6, [{"Wed Sep 25 20:41:08 CST 2013\n", 29}, {"sculkget: failed to lock /s01/or"..., 85}, {"\n", 1}], 3) = 115
times(NULL)                             = 744842024
fcntl(7, F_GETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0, pid=17470}) = 0
times(NULL)                             = 744842024
close(6)                                = 0
open("/s01/admin/G10R25/bdump/alert_G10R25.log", O_WRONLY|O_CREAT|O_APPEND, 0660) = 6
gettimeofday({1380112868, 403977}, NULL) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=405, ...}) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=405, ...}) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=405, ...}) = 0
writev(6, [{"Wed Sep 25 20:41:08 CST 2013\n", 29}, {"sculkget: lock held by PID: 1747"..., 33}, {"\n", 1}], 3) = 63
times(NULL)                             = 744842024
close(7)                                = 0
times(NULL)                             = 744842024
stat("/s01/admin/G10R25/udump", {st_mode=S_IFDIR|0750, st_size=147456, ...}) = 0
close(5)                                = 0
lstat("/s01/admin/G10R25/udump/g10r25_ora_17472.trc", 0x7fff584a52a0) = -1 ENOENT (No such file or directory)
stat("/s01/admin/G10R25/udump/g10r25_ora_17472.trc", 0x7fff584a52a0) = -1 ENOENT (No such file or directory)
open("/s01/admin/G10R25/udump/g10r25_ora_17472.trc", O_WRONLY|O_CREAT|O_TRUNC, 0660) = 5
write(5, "", 0)                         = 0
write(5, "/s01/admin/G10R25/udump/g10r25_o"..., 44) = 44
write(5, "\n", 1)                       = 1
write(5, "Oracle Database 10g Enterprise E"..., 154) = 154
write(5, "\n", 1)                       = 1
write(5, "ORACLE_HOME = /s01/oracle/produc"..., 48) = 48
write(5, "System name:\tLinux\n", 19)   = 19
write(5, "Node name:\tvrh8.oracle.com\n", 27) = 27
write(5, "Release:\t2.6.32-200.13.1.el5uek\n", 32) = 32
write(5, "Version:\t#1 SMP Wed Jul 27 21:02"..., 45) = 45
write(5, "Machine:\tx86_64\n", 16)      = 16
write(5, "Instance name: G10R25\n", 22) = 22
write(5, "Redo thread mounted by this inst"..., 47) = 47
write(5, "Oracle process number: 0\n", 25) = 25
write(5, "Unix process pid: 17472, image: "..., 54) = 54
write(5, "\n", 1)                       = 1
write(5, "\n", 1)                       = 1
times(NULL)                             = 744842024
gettimeofday({1380112868, 406531}, NULL) = 0
times(NULL)                             = 744842024
write(5, "*** 2013-09-25 20:41:08.406", 27) = 27
write(5, "\n", 1)                       = 1
write(5, "Oracle Instance Startup operatio"..., 113) = 113
write(5, "\n", 1)                       = 1
close(6)                                = 0
open("/s01/admin/G10R25/bdump/alert_G10R25.log", O_WRONLY|O_CREAT|O_APPEND, 0660) = 6
gettimeofday({1380112868, 407154}, NULL) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=405, ...}) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=405, ...}) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=405, ...}) = 0
writev(6, [{"Wed Sep 25 20:41:08 CST 2013\n", 29}, {"Oracle Instance Startup operatio"..., 113}, {"\n", 1}], 3) = 143
times(NULL)                             = 744842024
times(NULL)                             = 744842024
times(NULL)                             = 744842024
gettimeofday({1380112868, 407647}, NULL) = 0
times(NULL)                             = 744842024
write(5, "*** 2013-09-25 20:41:08.407", 27) = 27
write(5, "\n", 1)                       = 1
write(5, "Failed to acquire instance start"..., 67) = 67
write(5, "\n", 1)                       = 1
close(6)                                = 0
open("/s01/admin/G10R25/bdump/alert_G10R25.log", O_WRONLY|O_CREAT|O_APPEND, 0660) = 6
gettimeofday({1380112868, 408245}, NULL) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=405, ...}) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=405, ...}) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=405, ...}) = 0
writev(6, [{"Wed Sep 25 20:41:08 CST 2013\n", 29}, {"Failed to acquire instance start"..., 67}, {"\n", 1}], 3) = 97
times(NULL)                             = 744842025
open("/s01/oracle/product/10.2.0.5/db_1/rdbms/mesg/oraus.msb", O_RDONLY) = 7
fcntl(7, F_SETFD, FD_CLOEXEC)           = 0
lseek(7, 0, SEEK_SET)                   = 0
read(7, "\25\23\"\1\23\3\t\t\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 256) = 256
lseek(7, 512, SEEK_SET)                 = 512
read(7, "A\32;5A[\201u\266\205!\221\311\372\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
lseek(7, 1536, SEEK_SET)                = 1536
read(7, "W\32c\32r\32\206\32\223\32\233\32\366\32\0\33\f\33)\33>\33$\34-\0346\34@\34L\34"..., 512) = 512
lseek(7, 216576, SEEK_SET)              = 216576
read(7, "\t\0\360*\0\0>\0\363*\0\0p\0\365*\0\0\224\0\366*\0\0\322\0\367*\0\0\t\1"..., 512) = 512
close(7)                                = 0
open("/s01/oracle/product/10.2.0.5/db_1/rdbms/mesg/oraus.msb", O_RDONLY) = 7
fcntl(7, F_SETFD, FD_CLOEXEC)           = 0
lseek(7, 0, SEEK_SET)                   = 0
read(7, "\25\23\"\1\23\3\t\t\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 256) = 256
lseek(7, 512, SEEK_SET)                 = 512
read(7, "A\32;5A[\201u\266\205!\221\311\372\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
lseek(7, 1536, SEEK_SET)                = 1536
read(7, "W\32c\32r\32\206\32\223\32\233\32\366\32\0\33\f\33)\33>\33$\34-\0346\34@\34L\34"..., 512) = 512
lseek(7, 181248, SEEK_SET)              = 181248
read(7, "\f\0\351&\0\0P\0\352&\0\0|\0\353&\0\0\233\0\354&\0\0\272\0\356&\0\0\331\0"..., 512) = 512
close(7)                                = 0
write(11, "\1S\0\0\6\0\0\0\0\0\4\1\0\0\0\0\0\1\0\0\0\0\365*\0\0\0\0\0\0\0\0"..., 339) = 339
read(8,

回复 只看该作者 道具 举报

4#
发表于 2013-9-26 08:53:03
又理解了一些启动的机制,学习了。

回复 只看该作者 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2025-1-6 07:56 , Processed in 0.045883 second(s), 20 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569