整理了下关于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;

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools