Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15298
  • 博文数量: 5
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 35
  • 用 户 组: 普通用户
  • 注册时间: 2012-11-02 13:52
文章分类
文章存档

2012年(5)

我的朋友
最近访客

分类:

2012-11-02 13:58:13

原文地址:重启Oracle 作者:linux_kaige

//提交文章的时候,弹出个提示“文章中有违禁词汇,请修改”,检查之后才发现,里面我写了个“shabi”,cu博客还是挺人性化,赞一个!
重启Oracle:
Oracle由于打不到补丁,运行一段时间就出问题,准备重装,但是一直没重装,最近就是出了问题,就重启。。。

人总是很懒,最烦周末接电话了,中午tony打电话给我,说下星期有要给客户交付的东西么?我说没,然后说我们的主程请了婚假,进度咋办?他请假我都不知道,tony还不满意,说你们项目组的人请假你都不知道,你们好好沟通下吧。。。靠,这种请假是跟公司制度有关系,我虽然是项目的负责人,但请假他们是给他们直属领导请假的,这是公司的制度!!!
这种sb的制度,第一,请假人为什么不通知项目负责人?第二:他的直属领导为什么不通知他所在的项目的负责人?毕竟任务是从我这边分发的。

刚才客户又给我打电话说数据库的事儿,我不想弄,还得上vpn。。。我就说“你找XXX吧”,结果人家说是XXX让他找我了,我日。。。那就干吧。

好久没操作了,都tm忘记怎么整的了,命令都打错了,搞个sqlplus /nologin 。。。不废话了,写下操作步骤:
1.找到Oracle安装目录--bin目录
2.lnsrctl stop
3.sqlplus /nolog
4.conn /as sysdba;
5.shutdown immediate;
6.lnsrctl start
7.sqlplus /nolog
8.conn /as sysdba;
9.startup;
10.exit
很简单,但是注意查看屏幕打印的东西,是否报错。

  1. [oracle@cms01 ~]$ echo $ORACLE_HOME
  2. /u01/app/oracle/product/11.2/db1
  3. [oracle@cms01 ~]$ cd /u01/app/oracle/product/
  4. [oracle@cms01 product]$ ls
  5. 11.2
  6. [oracle@cms01 product]$ cd
  7. cd cdrdao cdrwtool
  8. cddb-slave2-properties cdrecord
  9. [oracle@cms01 product]$ cd 11.2/db1/
  10. apex/ cv/ instantclient/ mgw/ owm/ srvm/
  11. assistants/ dbs/ inventory/ network/ perl/ mn/ root.sh wwg/
  12. config/ EMStage/ ldap/ oracore/ scheduler/ xdk/
  13. crs/ has/ lib/ oraInst.loc slax/
  14. csmig/ hs/ log/ ord/ sqldeveloper/
  15. css/ ide/ md/ oui/ sqlj/
  16. ctx/ install/ mesg/ owb/ sqlplus/
  17. [oracle@cms01 product]$ cd 11.2/db1/bin/
  18. [oracle@cms01 bin]$ ls
  19. acfsroot emagtmc0 ldapmodifymt ott
  20. adapters emca ldapsearch owm
  21. d xmlcg
  22. emagent lcsscan orapwdO xmlwf
  23. emagent0 ldapadd oraxml xsl
  24. emagentdeploy.pl ldapaddmt oraxsl xsql
  25. EMAgentPatch.pm ldapbind orion xvm
  26. EMAgent.pm ldapcompare orionO zip
  27. emagtm ldapdelete osdbagrp
  28. emagtm0 ldapmoddn osdbagrp0
  29. emagtmc ldapmodify osh
  30. [oracle@cms01 bin]$ lsn
  31. lsnodes lsnrctl lsnrctl0
  32. [oracle@cms01 bin]$ lsnrctl stop
  33. LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 22-APR-2012 17:11:42
  34. Copyright (c) 1991, 2011, Oracle. All rights reserved.
  35. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=cms01)(PORT=1521)))
  36. The command completed successfully
  37. [oracle@cms01 bin]$ sqlplus /nologin
  38. SQL*Plus: Release 11.2.0.3.0 Production on Sun Apr 22 17:11:59 2012
  39. Copyright (c) 1982, 2011, Oracle. All rights reserved.
  40. SQL*Plus: Release 11.2.0.3.0 Production
  41. Copyright (c) 1982, 2011, Oracle. All rights reserved.
  42. Use SQL*Plus to execute SQL, PL/SQL and SQL*Plus statements.
  43. Usage 1: sqlplus -H | -V
  44. -H Displays the SQL*Plus version and the
  45. usage help.
  46. -V Displays the SQL*Plus version.
  47. Usage 2: sqlplus [ [
  48. -C Sets the compatibility of affected commands to the
  49. version specified by . The version has
  50. the form "x.y[.z]". For example, -C 10.2.0
  51. -L Attempts to log on just once, instead of
  52. reprompting on error.
  53. -M "" Sets automatic HTML markup of output. The options
  54. have the form:
  55. HTML [ON|OFF] [HEAD text] [BODY text] [TABLE text]
  56. [ENTMAP {ON|OFF}] [SPOOL {ON|OFF}] [PRE[FORMAT] {ON|OFF}]
  57. -R Sets restricted mode to disable SQL*Plus commands
  58. that interact with the file system. The level can
  59. be 1, 2 or 3. The most restrictive is -R 3 which
  60. disables all user commands interacting with the
  61. file system.
  62. -S Sets silent mode which suppresses the display of
  63. the SQL*Plus banner, prompts, and echoing of
  64. commands.
  65. is: {[/][@] | / }
  66. [AS {SYSDBA | SYSOPER | SYSASM}] [EDITION=value]
  67. Specifies the database account username, password and connect
  68. identifier for the database connection. Without a connect
  69. identifier, SQL*Plus connects to the default database.
  70. The AS SYSDBA, AS SYSOPER and AS SYSASM options are database
  71. administration privileges.
  72. can be in the form of Net Service Name
  73. or Easy Connect.
  74. @[ | [//]Host[:Port]/]
  75. is a simple name for a service that resolves
  76. to a connect descriptor.
  77. Example: Connect to database using Net Service Name and the
  78. database net service name is ORCL.
  79. sqlplus myusername/mypassword@ORCL
  80. Host specifies the host name or IP address of the database
  81. server computer.
  82. Port specifies the listening port on the database server.
  83. specifies the service name of the database you
  84. want to access.
  85. Example: Connect to database using Easy Connect and the
  86. Service name is ORCL.
  87. sqlplus myusername/mypassword@Host/ORCL
  88. The /NOLOG option starts SQL*Plus without connecting to a
  89. database.
  90. The EDITION specifies the value for Session Edition.
  91. is: @|[.] [ ...]
  92. Runs the specified SQL*Plus script from a web server (URL) or the
  93. local file system (filename.ext) with specified parameters that
  94. will be assigned to substitution variables in the script.
  95. When SQL*Plus starts, and after CONNECT commands, the site profile
  96. (e.g. $ORACLE_HOME/sqlplus/admin/glogin.sql) and the user profile
  97. (e.g. login.sql in the working directory) are run. The files may
  98. contain SQL*Plus commands.
  99. Refer to the SQL*Plus User's Guide and Reference for more information.
  100. [oracle@cms01 bin]$ sqlplus /nolog
  101. SQL*Plus: Release 11.2.0.3.0 Production on Sun Apr 22 17:13:17 2012
  102. Copyright (c) 1982, 2011, Oracle. All rights reserved.
  103. SQL> conn /as sysdba;
  104. Connected.
  105. SQL> shutdown immediate;
  106. Database closed.
  107. Database dismounted.
  108. ORACLE instance shut down.
  109. SQL> quit
  110. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
  111. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  112. [oracle@cms01 bin]$ lsnrctl start
  113. LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 22-APR-2012 17:14:37
  114. Copyright (c) 1991, 2011, Oracle. All rights reserved.
  115. Starting /u01/app/oracle/product/11.2/db1/bin/tnslsnr: please wait...
  116. TNSLSNR for Linux: Version 11.2.0.3.0 - Production
  117. System parameter file is /u01/app/oracle/product/11.2/db1/network/admin/listener.ora
  118. Log messages written to /u01/app/oracle/diag/tnslsnr/cms01/listener/alert/log.xml
  119. Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=cms01)(PORT=1521)))
  120. Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  121. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=cms01)(PORT=1521)))
  122. STATUS of the LISTENER
  123. ------------------------
  124. Alias LISTENER
  125. Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
  126. Start Date 22-APR-2012 17:14:37
  127. Uptime 0 days 0 hr. 0 min. 0 sec
  128. Trace Level off
  129. Security ON: Local OS Authentication
  130. SNMP OFF
  131. Listener Parameter File /u01/app/oracle/product/11.2/db1/network/admin/listener.ora
  132. Listener Log File /u01/app/oracle/diag/tnslsnr/cms01/listener/alert/log.xml
  133. Listening Endpoints Summary...
  134. (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=cms01)(PORT=1521)))
  135. (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  136. The listener supports no services
  137. The command completed successfully
  138. [oracle@cms01 bin]$ sqlplus /nolog
  139. SQL*Plus: Release 11.2.0.3.0 Production on Sun Apr 22 17:14:42 2012
  140. Copyright (c) 1982, 2011, Oracle. All rights reserved.
  141. SQL> conn /as sysdba;
  142. Connected to an idle instance.
  143. SQL> startup;
  144. ORACLE instance started.
  145. Total System Global Area 1.8840E+10 bytes
  146. Fixed Size 2236248 bytes
  147. Variable Size 2617245864 bytes
  148. Database Buffers 1.6173E+10 bytes
  149. Redo Buffers 47484928 bytes
  150. Database mounted.
  151. Database opened.
  152. SQL>
  153. SQL> quit
  154. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
  155. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  156. [oracle@cms01 bin]$
启动oracle 
su - oracle 
sqlplus /nolog 
conn /as sysdba 
startup 
exit 
lsnrctl start 
exit 

关闭oracle 
su - oracle 
sqlplus /nolog 
conn /as sysdba 
// conn as username/passwd
shutdown immediate 
exit 
lsnrctl stop 
exit 
****************************************************************************
linux下安装oracle10g,在执行autorunner之前,执行xhost+   上次是报dispaly变量错误,所以才无法打开图形界面安装。

又在csdn上看到这个哥们写的比较详细的操作步骤,分享一下:

  1. 在实际的应用中,有时候工作数据库需要重新启动。本文介绍了一个特别实用的操作步骤,希望对大家有所帮助。
  2.   1. 停应用层的各种程序
  3.   2. 停Oralce的监听进程
  4.   $ lsnrctl stop
  5.   3. 在独占的系统用户下,备份控制文件:
  6.   $ sqlplus "/as sysdba"
  7.   SQL> alter database backup controlfile to trace;
  8.   4. 在独占的系统用户下,手工切换重作日志文件,确保当前已修改过的数据存入文件:
  9.   SQL> alter system switch logfile;
  10.   5. 在独占的系统用户下,运行下面SQL语句,生成杀数据库用户连接的kill_all_session.sql文件:
  11.   SQL> set head off;
  12.   SQL> set feedback off;
  13.   SQL> set newpage none;
  14.   SQL> spool ./kill_session.sql
  15.   SQL> select 'alter system kill session '''  sid  ','  serial#  ''';' from v$session where username is not null;
  16.   SQL> spool off;
  17.   6. 在独占的系统用户下,执行杀数据库用户连接的kill_session.sql文件
  18.   SQL> @./kill_session.sql
  19.   7. 在独占的系统用户下,用immediate方式关闭数据库:
  20.   SQL> shutdown immediate;
  21.   或者
  22.   SVRMGRL> shutdown immediate;
  23.   8. 启动oralce的监听进程
  24.   $ lsnrctl start
  25.   9. 进入独占的系统用户下,启动Oralce数据库
  26.   $ sqlplus /nolog
  27.   SQL> connect / as sysdba
  28.   SQL> startup;
  29.   或者
  30.   $ svrmgrl
  31.   SVRMGRL> connect internal;
  32.   SVRMGRL> startup;
  33.   10.启动应用层的各种程序
尊重作者,原文地址:http://blog.csdn.net/usthycp/article/details/3847624






阅读(1538) | 评论(0) | 转发(0) |
0

上一篇:一次Oracle rac宕机分析

下一篇:没有了

给主人留下些什么吧!~~