在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
在单机环境下,要想启动或关闭ORACLE系统必须首先切换到ORACLE用户,如下 su - oracle Oracle数据库有以下几种启动方式: startup nomount 非安装启动,这种方式启动下可执行:重建控制文件、重建数据库 2、 startup mount dbname 安装启动,这种方式启动下可执行: 执行“nomount”,然后打开控制文件,确认数据文件和联机日志文件的位置, 3、 startup open dbname 先执行“nomount”,然后执行“mount”,再打开包括Redo log文件在内的所有数据库文件, 4、startup,等于以下三个命令 startup nomount alter database mount alter database open 5、 startup restrict 约束方式启动 6、 startup force 强制启动方式 7、startup pfile=参数文件名 startup pfile=E:Oracleadminoradbpfileinit.ora
1、 shutdown normal 正常方式关闭数据库。 shutdown immediate 立即方式关闭数据库。 shutdown abort 直接关闭数据库,正在访问数据库的会话会被突然终止, [oracle@node1 dbs]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Sun Mar 17 16:38:03 2013 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to an idle instance SQL> startup nomount ORA-00845: MEMORY_TARGET not supported on this system 启动数据库时,报MEMORY_TARGET 不支持,上网搜索了一下,具体原因是Linux 系统的共享内存比SGA 配置的小。而/dev/shm 是根据tmpfs 的配置来定义的。 [root@node1 ~]# df -h /dev/shm Filesystem Size Used Avail Use% Mounted on tmpfs 1000M 0 1000M 0% /dev/shm SQL> show parameter memory_target NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ memory_target big integer 1G 查了一下tmpfs 的配置,只有1000M,而SGA 配置了1G(换算系1024M),不够大。解决问题的办法就是改小SGA 或者改大tmpfs(这里SGA 1G 已经小了,不建议在改小)。 [root@node1 ~]# vim /etc/fstab # tmpfs /dev/shm tmpfs defaults 0 0 tmpfs /dev/shm tmpfs defaults,size=2048M 0 0 [root@node1 ~]# umount /dev/shm [root@node1 ~]# mount /dev/shm [root@node1 ~]# df -h /dev/shm Filesystem Size Used Avail Use% Mounted on tmpfs 2.0G 0 2.0G 0% /dev/shm 解决方法2、修改SGA: SQL> show parameter sga NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ lock_sga boolean FALSE pre_page_sga boolean FALSE sga_max_size big integer 1G sga_target big integer 0 SQL> alter system set sga_max_size=768M scope=spfile; System altered. SQL> shutdown immediate ORA-01507: database not mounted ORACLE instance shut down. SQL> startup nomount ORACLE instance started. Total System Global Area 801701888 bytes Fixed Size 2217632 bytes Variable Size 348129632 bytes Database Buffers 444596224 bytes Redo Buffers 6758400 bytes SQL> show parameter sga NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ lock_sga boolean FALSE pre_page_sga boolean FALSE sga_max_size big integer 768M sga_target big integer 0 这里建议直接修改memory_target,让Oracle 自己去管理SGA 的大小(memory_target=SGA+PGA) SQL> show parameter memory_target NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ memory_target big integer 1G SQL> alter system set memory_target=768M scope=spfile; System altered. SQL> shutdown immediate ORA-01507: database not mounted ORACLE instance shut down. SQL> startup nomount; ORACLE instance started. Total System Global Area 801701888 bytes Fixed Size 2217632 bytes Variable Size 469764448 bytes Database Buffers 322961408 bytes Redo Buffers 6758400 bytes SQL> SQL> SQL> show parameter memory_target NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ memory_target big integer 768M 扩展: SQL> startup nomount ORA-00844: Parameter not taking MEMORY_TARGET into account ORA-00851: SGA_MAX_SIZE 1073741824 cannot be set to more than MEMORY_TARGET 805306368. 解决办法: [oracle@node1 dbs]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Sun Mar 17 17:14:38 2013 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to an idle instance. SQL> create pfile from spfile; File created. SQL> exit 修改init.ora 文件参数 [oracle@node1 dbs]$ vim initoranode1.ora oranode1.__db_cache_size=444596224 oranode1.__large_pool_size=4194304 oranode1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment *.audit_file_dest='/u01/app/oracle/admin/oranode1/adump' *.audit_trail='db' *.compatible='11.2.0' *.control_files='/u01/oradata/ora_control1','/u01/fast_recovery_area/ora_control 2' *.db_block_size=8192 *.db_domain='node1.example.com' *.db_name='oranode1' *.db_recovery_file_dest='/u01/fast_recovery_area' *.db_recovery_file_dest_size=2G *.diagnostic_dest='/u01/app/oracle' *.dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)' *.memory_target=805306368 *.open_cursors=300 *.processes=150 *.remote_login_passwordfile='EXCLUSIVE' *.sga_max_size=805306368 *.undo_tablespace='UNDOTBS1' 重新生成spfile [oracle@node1 dbs]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Sun Mar 17 17:15:28 2013 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to an idle instance. SQL> create spfile from pfile; File created. SQL> startup nomount; ORACLE instance started. Total System Global Area 801701888 bytes Fixed Size 2217632 bytes Variable Size 469764448 bytes Database Buffers 322961408 bytes Redo Buffers 6758400 bytes SQL> SQL> SQL> show parameter memory_target NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ memory_target big integer 768M |
请发表评论