Home Database Mysql Tutorial Oracle数据库startup和shutdown方式

Oracle数据库startup和shutdown方式

Jun 07, 2016 pm 04:59 PM

整理了下关于quot;Oracle数据库提供了几种不同数据库启动和关闭方式quot;,然后,自己就回去就写了个示例. 其中,就出现了1个问

整理了下关于"Oracle数据库提供了几种不同数据库启动和关闭方式",然后,自己就回去就写了个示例.

   其中,就出现了1个问题:

   ORA-12528: TNS:listener: all appropriate instances are blocking new connections

   于是到网上就大量的查阅资料,哈哈,好不错,解决方法找到了.其中红色的就是主要解决方法.下面就把我整理的东西给共享下.

   一:注意事项

要启动和关闭数据库,必须要以具有Oracle 管理员权限用户登陆,通常也就是以具有SYSDBA权限用户登陆。一般我们常用INTERNAL用户来启动和关闭数据库(INTERNAL用户实际上是SYS用户以SYSDBA连接同义词)。Oracle数据库新版本将逐步淘汰INTERNAL这个内部用户,所以我们最还是设置DBA用户具有SYSDBA权限。

二:启动一个数据库需要三个步骤
  1、 创建一个Oracle实例(非安装阶段)
  2、 由实例安装数据库(安装阶段)
3、 打开数据库(打开阶段)

三:Startup(启动数据库命令)

1、 STARTUP NOMOUNT
NONOUNT选项仅仅创建一个Oracle实例。读取init.ora初始化参数文件、启动后台进程、初始化系统全局区(SGA)。Init.ora文件定义了实例配置,包括内存结构大小和启动后台进程数量和类型等。实例名根据Oracle_SID设置,不一定要与打开数据库名称相同。当实例打开后,系统将显示一个SGA内存结构和大小列表,如下所示:
SQL> startup nomount
ORACLE 例程已经启动。
Total System Global Area 35431692 bytes
Fixed Size 70924 bytes
Variable Size 18505728 bytes
Database Buffers 16777216 bytesu
Redo Buffers 77824 bytes

2、STARTUP MOUNT
该命令创建实例并且安装数据库,但没有打开数据库。Oracle系统读取控制文件中关于数据文件和重作日志文件内容,但并不打开该文件。这种打开方式常在数据库维护操作中使用,如对数据文件更名、改变重作日志以及打开归档方式等。在这种打开方式下,除了可以看到SGA系统列表以外,系统还会给出"数据库装载完毕"提示。

  3、STARTUP
  该命令完成创建实例、安装实例和打开数据库所有三个步骤。此时数据库使数据文件和重作日志文件在线,通常还会请求一个或者是多个回滚段。这时系统除了可以看到前面Startup Mount方式下所有提示外,还会给出一个"数据库已经打开"提示。此时,数据库系统处于正常工作状态,可以接受用户请求。

如果采用STARTUP NOMOUNT或者是STARTUP MOUNT数据库打开命令方式,必须采用ALTER DATABASE命令来执行打开数据库操作。例如,如果你以STARTUP NOMOUNT方式打开数据库,也就是说实例已经创建,但是数据库没有安装和打开。这是必须运行下面两条命令,数据库才能正确启动。
ALTER DATABASE MOUNT;
ALTER DATABASE OPEN

4、其他打开方式
  除了前面介绍三种数据库打开方式选项外,还有另外其他一些选项。
  (1) STARTUP RESTRICT
  这种方式下,数据库将被成功打开,但仅仅允许一些特权用户(具有DBA角色用户)才可以使用数据库。这种方式常用来对数据库进行维护,如数据导入/导出操作时不希望有其他用户连接到数据库操作数据。
  (2) STARTUP FORCE
  该命令其实是强行关闭数据库(shutdown abort)和启动数据库(startup)两条命令一个综合。该命令仅在关闭数据库遇到问题不能关闭数据库时采用。
  (3) ALTER DATABASE OPEN READ ONLY;
  该命令在创建实例以及安装数据库后,以只读方式打开数据库。对于那些仅仅提供查询功能产品数据库可以采用这种方式打开。
四:数据库关闭(SHUTDOWN)
1、SHUTDOWN NORMAL
  这是数据库关闭SHUTDOWN命令确省选项。也就是说如果你发出SHUTDOWN这样命令,也即是SHUTDOWN NORNAL意思。
  发出该命令后,任何新连接都将再不允许连接到数据库。在数据库关闭之前,Oracle将等待目前连接所有用户都从数据库中退出后才开始关闭数据库。采用这种方式关闭数据库,在下一次启动时不需要进行任何实例恢复。但需要注意一点是,采用这种方式,也许关闭一个数据库需要几天时间,也许更长。
  2、SHUTDOWN IMMEDIATE
  这是我们常用一种关闭数据库方式,想很快地关闭数据库,但又想让数据库干净关闭,常采用这种方式。
  当前正在被Oracle处理SQL语句立即中断,系统中任何没有提交事务全部回滚。如果系统中存在一个很长未提交事务,采用这种方式关闭数据库也需要一段时间(该事务回滚时间)。系统不等待连接到数据库所有用户退出系统,强行回滚当前所有活动事务,然后断开所有连接用户。
  3、SHUTDOWN TRANSACTIONAL
  该选项仅在Oracle 8i后才可以使用。该命令常用来计划关闭数据库,它使当前连接到系统且正在活动事务执行完毕,运行该命令后,任何新连接和事务都是不允许。在所有活动事务完成后,数据库将和SHUTDOWN IMMEDIATE同样方式关闭数据库。
  4、SHUTDOWN ABORT
  这是关闭数据库最后一招,也是在没有任何办法关闭数据库情况下才不得不采用方式,,一般不要采用。如果下列情况出现时可以考虑采用这种方式关闭数据库。


下面是问题解决:
ORA-12528: TNS:listener: all appropriate instances are blocking new connections
1:修改listener.ora的参数
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = C:\oracle\product\10.1.0\db_1)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = ammicly)
      (ORACLE_HOME = c:\oracle\product\10.1.0\db_1)
      (SID_NAME = ammicly)
    )
  )
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = lypch )(PORT = 1521))
      )
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
      )
    )
  )

2:修改tnsnames.ora的参数

AMMICLY =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = lypch )(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ammicly)
     (UR=A)
    )
  )
EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )
启动数据库
SQL> conn /as sysdba
SQL> alter database mount;
SQL> alter database open;

关闭数据库
SQL> shutdown immediate;

linux

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Explain InnoDB Full-Text Search capabilities. Explain InnoDB Full-Text Search capabilities. Apr 02, 2025 pm 06:09 PM

InnoDB's full-text search capabilities are very powerful, which can significantly improve database query efficiency and ability to process large amounts of text data. 1) InnoDB implements full-text search through inverted indexing, supporting basic and advanced search queries. 2) Use MATCH and AGAINST keywords to search, support Boolean mode and phrase search. 3) Optimization methods include using word segmentation technology, periodic rebuilding of indexes and adjusting cache size to improve performance and accuracy.

How do you alter a table in MySQL using the ALTER TABLE statement? How do you alter a table in MySQL using the ALTER TABLE statement? Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

When might a full table scan be faster than using an index in MySQL? When might a full table scan be faster than using an index in MySQL? Apr 09, 2025 am 12:05 AM

Full table scanning may be faster in MySQL than using indexes. Specific cases include: 1) the data volume is small; 2) when the query returns a large amount of data; 3) when the index column is not highly selective; 4) when the complex query. By analyzing query plans, optimizing indexes, avoiding over-index and regularly maintaining tables, you can make the best choices in practical applications.

Can I install mysql on Windows 7 Can I install mysql on Windows 7 Apr 08, 2025 pm 03:21 PM

Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

Difference between clustered index and non-clustered index (secondary index) in InnoDB. Difference between clustered index and non-clustered index (secondary index) in InnoDB. Apr 02, 2025 pm 06:25 PM

The difference between clustered index and non-clustered index is: 1. Clustered index stores data rows in the index structure, which is suitable for querying by primary key and range. 2. The non-clustered index stores index key values ​​and pointers to data rows, and is suitable for non-primary key column queries.

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

How do you handle large datasets in MySQL? How do you handle large datasets in MySQL? Mar 21, 2025 pm 12:15 PM

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

How do you drop a table in MySQL using the DROP TABLE statement? How do you drop a table in MySQL using the DROP TABLE statement? Mar 19, 2025 pm 03:52 PM

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

See all articles