ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 天天学习oracle(一)

天天学习oracle(一)

原创 Linux操作系统 作者:anycall2010 时间:2009-03-16 15:13:10 0 删除 编辑

1.查看ORACLE可执行文件大小:

[oracle@dg1 bin]$ ls -l oracle
-rwsr-s--x 1 oracle oinstall 93362156 Aug 23  2008 oracle

2.判断ORACLE数据库是32位还是64位

[oracle@dg1 bin]$ file oracle
oracle: setuid setgid ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped

3.数据库启动顺序:

PMON started with pid=2, OS id=12663
PSP0 started with pid=3, OS id=12665
MMAN started with pid=4, OS id=12667
DBW0 started with pid=5, OS id=12669
LGWR started with pid=6, OS id=12671
CKPT started with pid=7, OS id=12673
SMON started with pid=8, OS id=12675
RECO started with pid=9, OS id=12677
CJQ0 started with pid=10, OS id=12679
MMON started with pid=11, OS id=12681

4.SPID和操作系统进程对应关系:

SQL> select addr,pid,spid,username,program from v$process;

ADDR            PID SPID         USERNAME
-------- ---------- ------------ ---------------
PROGRAM
------------------------------------------------
3E61627C          1
PSEUDO

3E616830          2 1366         oracle
oracle@dg1 (PMON)

3E616DE4          3 1368         oracle
oracle@dg1 (PSP0)

3E617398          4 1370         oracle
oracle@dg1 (MMAN)

3E61794C          5 1372         oracle
oracle@dg1 (DBW0)

3E617F00          6 1374         oracle
oracle@dg1 (LGWR)

[oracle@dg1 bdump]$ ps -ef |grep ora
root       300 31531  0 02:45 pts/1    00:00:00 su - oracle
oracle     301   300  0 02:45 pts/1    00:00:00 -bash
oracle    1366     1  0 03:18 ?        00:00:00 ora_pmon_dg1
oracle    1368     1  0 03:18 ?        00:00:00 ora_psp0_dg1
oracle    1370     1  0 03:18 ?        00:00:00 ora_mman_dg1
oracle    1372     1  0 03:18 ?        00:00:00 ora_dbw0_dg1
oracle    1374     1  0 03:18 ?        00:00:00 ora_lgwr_dg1
。。。。。。

该用法可以看出操作系统中的PID和v$process视图中的SPID是关联的。因此如果操作系统某进程异常高的情况下,我们可以找到OS上进程在数据库内部的化身。

V$PROCESS进程包含当前数据库活动信息,这些进程在操作系统都存在与之相对应的OS进程。

SQL> desc v$process;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ADDR                                               RAW(4)
 PID                                                NUMBER
 SPID                                               VARCHAR2(12)
 USERNAME                                           VARCHAR2(15)
 SERIAL#                                            NUMBER
 TERMINAL                                           VARCHAR2(30)
 PROGRAM                                            VARCHAR2(48)
 TRACEID                                            VARCHAR2(255)
 BACKGROUND                                         VARCHAR2(1)
 LATCHWAIT                                          VARCHAR2(8)
 LATCHSPIN                                          VARCHAR2(8)
 PGA_USED_MEM                                       NUMBER
 PGA_ALLOC_MEM                                      NUMBER
 PGA_FREEABLE_MEM                                   NUMBER
 PGA_MAX_MEM                                        NUMBER

其中LACHWAIT进程表示当前正在等待的LARCH信息。LACHSPIN记录进程正在通过SPIN进行LATCH的竞争。LATCH通常叫做”闩“,是数据库内部的串行锁机制。主要用来控制内存上的并发,在多处理器中,ORACLE进程通过SPIN来进行LATCH争夺。

ADDR代表进程地址,进程的状态等信息在内存中的记录。      

在V$SESSION视图中记录的PADDR就是V$PROCESS.ADDR的进一步延伸,两者是关联的。

SQL> select PADDR,STATE,PROCESS,SID from v$session;

PADDR    STATE               PROCESS             SID
-------- ------------------- ------------ ----------
3E61DFF4 WAITING             1426                145
3E61DA40 WAITING             1424                147
3E61B254 WAITING             2437                150
3E61C924 WAITING             1414                152
3E61BDBC WAITING             1410                155
3E61B808 WAITING             1408                156
3E61C370 WAITED SHORT TIME   2301                158
3E61A138 WAITING             1386                160
3E619B84 WAITING             1384                161
3E6195D0 WAITING             1382                162
3E61901C WAITING             1380                163

PADDR    STATE               PROCESS             SID
-------- ------------------- ------------ ----------
3E618A68 WAITING             1378                164
3E6184B4 WAITING             1376                165
3E617F00 WAITING             1374                166
3E61794C WAITING             1372                167
3E617398 WAITING             1370                168
3E616DE4 WAITING             1368                169
3E616830 WAITING             1366                170

18 rows selected.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8334342/viewspace-567512/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-06-24

  • 博文量
    182
  • 访问量
    568766