New features with oracle9i-Pause (quiescing) database

Source: Internet
Author: User
oracle| Data | database
Original Author: Sameer Wadhwa

Pause (quiescing) A database is a powerful new feature that allows DBAs to complete some of the operations that a database is in restricted mode (restricted modes). With this feature, the DBA can execute queries, Pl/sql, and other transactions when logged into the SYS or SYSTEM account. All other users ' sessions will be paused (suspended), and once the DBA has put the database back into normal mode, the user's sessions will continue to run automatically.



Figure 1a: The database is in a normal state.



Figure 1b: The database is in a state.

Figure 1a is the system state in which the database is in normal mode, in which both the DBA and the user's transactions are running. Some DBA transactions are limited because the database must be in restricted mode to run these transactions. In contrast, Figure 1b is the case where the database is at a standstill, in which all the user's transactions are blocked (blocked) without restarting the database to the restricted mode, and the DBA's affairs are running without problems.



Once all active sessions have executed a commit or rollback, the database will be paused.

Let's take a look at how it's done. The main command used to pause the database is alter SYSTEM QUIESCE restricted; I will first use Sqlplus login to perform this operation.

C:\> U:\>sqlplus/nolog

Sql*plus:release 9.2.0.1.0-production on Wed Apr 16 16:08:27 2003

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Sql> Connect Sys/change_on_install as Sysdba
Connected.

sql> ALTER SYSTEM quiesce restricted;
ALTER SYSTEM Quiesce restricted
*
ERROR at line 1:
Ora-25507:resource Manager has not been continuously on

If the error indicates that the Resource Manager (Resource Manager) is inactive, make it active you can:

Sql> alter system set resource_manager_plan= ' System_plan ' scope=spfile sid= ' or9i ';

System altered.

Or9i is my SID.

You have to restart the database after this operation.

Sql> Show Parameter Resource_manager_plan

NAME TYPE VALUE

------------------------------------ ----------- ----------------

Resource_manager_plan string System_plan

sql> ALTER SYSTEM quiesce restricted;

System altered.

If there are pending transactions that need to be committed or rolled back, the previous command will be suspended pending completion of the transaction. To determine which user's session is not committed or rolled back, you can use the following statement.

SELECT S.sid,s.serial#,s.machine,s.terminal,s.username
From V$session S WHERE S.sid in
(SELECT SID from V$lock WHERE type= ' TX ')
/

The results of the query will provide sufficient information to enable you to request those users to submit, rollback or terminate their transactions. The worse thing is that you can kill these sessions and the session will be automatically rolled back. After the system is paused, you will be able to work without interference from other users, and you can use the following command to lift the pause state:

sql> ALTER SYSTEM Unquiesce;

System altered.
Scenario 1:
Transaction order

User session

DBA session

(1)

Connected with SCOTT

sql> Update Emp3 Set

Ename= ' John '

Where ename= ' Samir ';

Connected with SYS

(2)



sql> ALTER SYSTEM quiesce restricted;



Wait for user Scott to complete the transaction.

(3)

Sql> commit;



Commit complete.



(4)



System altered.

The first scenario shows that the DBA is not able to pause the database until all activities have been completed. Once the database is paused, the library renders a stop (halt) or inactive (inactive) state to other users. Then, when the database becomes normal, all of the data blocks and paused transactions continue to run.

Scenario 2:

Transaction order

User session

DBA session

(1)

Connected with Scott User.

Connected with SYS.

sql> ALTER SYSTEM quiesce restricted;

System altered.

(2)

Select * from EMP;

Wait for result



(3)



sql> ALTER SYSTEM Unquiesce;

System altered.



EMPNO ename SALARY

---------    ----------   ----------

1 Sasa 1000

2 John 5000

3 Hema 7000

User can the results.



Scenario 2 shows how it affects the user's session. In short, the system is temporarily invalid for end users.
Some of the usual questions:
(Q) How do you check the status of your database as a DBA?

(A) You can check the Active_state field in the V$instance view.

Sql> SELECT active_state from V$instance;

Active_st

---------

NORMAL

There are several possible values for active_state:

Active_state

Describe
Normal
Database is in a normal state

Quiescing

The DATABASE wants to quiesced but waiting for active running transactions to finish.

The database wants to pause, but waits for the active running transaction to complete.





Quiesced

The database is in a standstill state.



(Q) How do you determine which sessions are connected to the library waiting for a paused database?

(A) The following query can be used to determine:

Select sid,event,total_waits,time_waited "Time waited[100 of SEC]",

Average_wait from V$session_event

WHERE event= ' Wait for possible quiesce finish '

/

Sql>

SID EVENT total_waits time waited[100 of Sec] average_wait

--- ---------------------------------- -----------            ----------------------- ------------

6 wait for possible QUIESCE finish 412 126532 307

The event "Wait for possible quiesce finish" indicates that the session is waiting for a "stalled" database so that it cannot carry out its things. These sessions will render a hung state after the library has paused.

(Q) What do I need to do for the Resource Manager plan (Resource manager plans) before pausing the database?

(A) When you pause the database, the INTERNAL_QUIESCE resource plan is activated. The ACTIVE_SESS_POOL_P1 in all other resource groups except sys_groups should be set to 0. Because both SYS and system users belong to the Sys_groups group, only they can connect to the database.

To view details, you can query dba_rsrc_plan_directives this view.

Remember the following points:
A database that is in a standstill state has only the SYS and system is a valid user to perform maintenance work, and other users with DBA authority are considered normal users. Backing up data files (cold standby, copy data files) in a stalled database is not valid. If there are "active" transactions in the library, the library cannot be paused.
Need to start database to set resource schedule
The pause data is a new feature of 9i, so it is not available in previous versions.
Conclusion:

The pause database is a powerful feature that allows DBAs to perform some special maintenance work without restarting the database.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.