`

ORACLE restricting access(原创)

 
阅读更多

Restricting Access to an Instance at Startup
You can start an instance, and optionally mount and open a database, in restricted mode so that the instance is available only to administrative personnel (not general database users). Use this mode of instance startup when you must accomplish one of the following tasks:

  •     Perform an export or import of data
  •     Perform a data load (with SQL*Loader)
  •     Temporarily prevent typical users from using data
  •     Perform certain migration or upgrade operations

Typically, all users with the CREATE SESSION system privilege can connect to an open database. Opening a database in restricted mode allows database access only to users with both the CREATE SESSION and RESTRICTED SESSION system privilege. Only database administrators should have the RESTRICTED SESSION system privilege. Further, when the instance is in restricted mode, a database administrator cannot access the instance remotely through an Oracle Net listener, but can only access the instance locally from the system that the instance is running on.
Later, use the ALTER SYSTEM statement to disable the RESTRICTED SESSION feature:
ALTER SYSTEM DISABLE RESTRICTED SESSION;
Note: in RAC environment, the srvctl command recored in the official document to start instance in restricted doesn't work properly.We can only use

start restriected;

or

ALTER SYSTEM ENABLE RESTRICTED SESSION;

indivually to put RAC instance to restricted session.

RESTRICTED SESSION
The RESTRICTED SESSION clause lets you restrict logon to Oracle Database. You can use this clause regardless of whether your instance has the database dismounted or mounted, open or closed.

  • Specify ENABLE to allow only users with RESTRICTED SESSION system privilege to log on to Oracle Database. Existing sessions are not terminated.
  • This clause applies only to the current instance. Therefore, in an Oracle RAC environment, authorized users without the RESTRICTED SESSION system privilege can still access the database by way of other instances.

Specify DISABLE to reverse the effect of the ENABLE RESTRICTED SESSION clause, allowing all users with CREATE SESSION system privilege to log on to Oracle Database. This is the default.

Note: v$instance.logins column present the restricted status.

Quiescing a Database
Occasionally you might want to put a database in a state that allows only DBA transactions, queries, fetches, or PL/SQL statements. Such a state is referred to as a quiesced state, in the sense that no ongoing non-DBA transactions, queries, fetches, or PL/SQL statements are running in the system.
Note:
In this discussion of quiesce database, a DBA is defined as user SYS or SYSTEM. Other users, including those with the DBA role, are not allowed to issue the ALTER SYSTEM QUIESCE DATABASE statement or proceed after the database is quiesced.
The quiesced state lets administrators perform actions that cannot safely be done otherwise. These actions include:

  • Actions that fail if concurrent user transactions access the same object--for example, changing the schema of a database table or adding a column to an existing table where a no-wait lock is required.
  • Actions whose undesirable intermediate effect can be seen by concurrent user transactions--for example, a multistep procedure for reorganizing a table when the table is first exported, then dropped, and finally imported. A concurrent user who attempts to access the table after it was dropped, but before import, would not have an accurate view of the situation.

Without the ability to quiesce the database, you would need to shut down the database and reopen it in restricted mode. This is a serious restriction, especially for systems requiring 24 x 7 availability. Quiescing a database is much a smaller restriction, because it eliminates the disruption to users and the downtime associated with shutting down and restarting the database.
When the database is in the quiesced state, it is through the facilities of the Database Resource Manager that non-DBA sessions are prevented from becoming active. Therefore, while this statement is in effect, any attempt to change the current resource plan will be queued until after the system is unquiesced.
Placing a Database into a Quiesced State
To place a database into a quiesced state, issue the following statement:
ALTER SYSTEM QUIESCE RESTRICTED;
Non-DBA active sessions will continue until they become inactive. An active session is one that is currently inside of a transaction, a query, a fetch, or a PL/SQL statement; or a session that is currently holding any shared resources (for example, enqueues). No inactive sessions are allowed to become active. For example, If a user issues a SQL query in an attempt to force an inactive session to become active, the query will appear to be hung. When the database is later unquiesced, the session is resumed, and the blocked action is processed.
Once all non-DBA sessions become inactive, the ALTER SYSTEM QUIESCE RESTRICTED statement completes, and the database is in a quiesced state. In an Oracle Real Application Clusters environment, this statement affects all instances, not just the one that issues the statement.
The ALTER SYSTEM QUIESCE RESTRICTED statement may wait a long time for active sessions to become inactive. You can determine the sessions that are blocking the quiesce operation by querying the V$BLOCKING_QUIESCE view. This view returns only a single column: SID (Session ID). You can join it with V$SESSION to get more information about the session, as shown in the following example:
select bl.sid, user, osuser, type, program
from v$blocking_quiesce bl, v$session se
where bl.sid = se.sid;
If you interrupt the request to quiesce the database, or if your session terminates abnormally before all active sessions are quiesced, then Oracle Database automatically reverses any partial effects of the statement.
For queries that are carried out by successive multiple Oracle Call Interface (OCI) fetches, the ALTER SYSTEM QUIESCE RESTRICTED statement does not wait for all fetches to finish. It only waits for the current fetch to finish.

For both dedicated and shared server connections, all non-DBA logins after this statement is issued are queued by the Database Resource Manager, and are not allowed to proceed. To the user, it appears as if the login is hung. The login will resume when the database is unquiesced.
The database remains in the quiesced state even if the session that issued the statement exits. A DBA must log in to the database to issue the statement that specifically unquiesces the database.
Note:You cannot perform a cold backup when the database is in the quiesced state, because Oracle Database background processes may still perform updates for internal purposes even while the database is quiesced. In addition, the file headers of online datafiles continue to appear to be accessible. They do not look the same as if a clean shutdown had been performed. However, you can still take online backups while the database is in a quiesced state.
Restoring the System to Normal Operation
The following statement restores the database to normal operation:
ALTER SYSTEM UNQUIESCE;
All non-DBA activity is allowed to proceed. In an Oracle Real Application Clusters environment, this statement is not required to be issued from the same session, or even the same instance, as that which quiesced the database. If the session issuing the ALTER SYSTEM UNQUIESCE statement terminates abnormally, then the Oracle Database server ensures that the unquiesce operation completes.
Viewing the Quiesce State of an Instance
You can query the ACTIVE_STATE column of the V$INSTANCE view to see the current state of an instance. The column values has one of these values:
    NORMAL: Normal unquiesced state.
    QUIESCING: Being quiesced, but some non-DBA sessions are still active.
    QUIESCED: Quiesced; no non-DBA sessions are active or allowed.

参考至:http://docs.oracle.com/cd/E11882_01/server.112/e25494/start.htm#ADMIN11155

             https://community.oracle.com/thread/1012521?tstart=0

             http://docs.oracle.com/cd/E11882_01/server.112/e25494/start.htm#ADMIN11147

             http://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_2014.htm#SQLRF53136

             https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:902149038276

             http://docs.oracle.com/cd/B28359_01/server.111/b28310/start004.htm#ADMIN11164

本文原创,转载请注明出处、作者

如有错误,欢迎指正

邮箱:czmcj@163.com

0
0
分享到:
评论

相关推荐

    oracle 061

    oracle sql exam 1z0-061 practice exam chapter 3 - restricting & sorting data

    Oracle Database 10g: The Top 20 Features for DBAs

    **Description:** VPD enhances security by dynamically restricting access to data based on user attributes or session characteristics. It ensures that users only see data they are authorized to access....

    oracle官方ppt

    2. **02 Restricting and Sorting Data.ppt**:在这个主题中,你会学习到如何使用WHERE子句来过滤查询结果,以及ORDER BY子句对查询结果进行排序,这些都是SQL查询中的核心部分。 3. **03 Single-Row Functions.ppt...

    Linux_Security_Cookbook

    The Linux Security Cookbook includes real solutions to a wide range of targeted problems, such as sending encrypted email within Emacs, restricting access to network services at particular times of ...

    oracle ocp007 笔记

    2. **Restricting and Sorting Data** - `WHERE`子句用于过滤数据,如`SELECT * FROM kong.authors WHERE au_id LIKE '1%'`。 - 数据类型如字符串和日期需要用单引号括起,且区分大小写。 - 比较运算符包括`=`, `...

    Restricting Good Receipt Unless Production order confirmed

    在SAP系统中,"Restricting Good Receipt Unless Production order confirmed"是一种控制策略,用于确保只有当生产订单被确认后,才能执行收货操作。这种策略对于企业的生产流程管理至关重要,因为它可以避免未经...

    Oracle Solaris 8 Solaris 8 (Intel Platform Edition) 1/ 01 Releas

    在文档中,我们可以看到许可协议的信息,例如“Distributed under licenses restricting its use, copying, distribution, and decompilation.”这意味着 Solaris 8 (Intel Platform Edition) 1/01 的使用、复制、...

    考研英语备战:长难句例句分析(15).doc

    在第二个例句“The Internet-and pressure from funding agencies, who are questioning why commercial publishes are making money from government-funded research by restricting access to it - is making ...

    Restricting the nonlinearity parameter in soil greenhouse gas flux calculation

    The static chamber approach is often used for greenhouse gas (GHG) flux measurements, whereby the flux is deduced from the increase of species concentration after closing the chamber....

    Windows注册表的攻击与防护.doc

    The registry can be protected by using security software, restricting access to the registry, and regularly backing up the registry. 在注册表旳保护中,INF 文献、JS 文献和组方略功能是常用的方法。INF ...

    System Security Lecture Notes (StonyBrook CSE509)

    This involves ensuring that users can access the system resources they need while preventing unauthorized access or actions that could compromise the system's integrity or availability. #### ...

    Vulkan CookBook

    This is one of the main reasons for restricting the hardware to show its full potential. The new approach tries to overcome these struggles–it gives users much more control over the hardware, but ...

    Cisco Press - OSPF Network Design Solutions, 2nd Edition

    Contents at a Glance Introduction xix Part I OSPF Fundamentals and Communication 3 Chapter 1 Networking and Routing Fundamentals 5 Chapter 2 Introduction to OSPF 47 Chapter 3 OSPF Communication 103 ...

    strongloop离线官方文档

    - **1.9.4 Restricting access to related models**:解释了如何限制对关联模型的访问。 - **1.9.5 Creating a default admin user**:提供了创建默认管理员用户的步骤。 - **1.9.6 Security considerations**:...

    Clean Architecture A Craftsman's Guide to Software Structure and Design

    See how programming paradigms impose discipline by restricting what developers can do Understand what’s critically important and what’s merely a “detail” Implement optimal, high-level structures...

    Django 1.0 Website Development.pdf

    Restricting access to logged-in users 80 Methods for browsing bookmarks 81 Improving the user page 83 Creating a tag page 85 Building a tag cloud 87 A word on security 90 SQL injection 91 Cross...

    Clean Architecture

    Master essential software design principles for addressing function, component separation, and data management, See how programming paradigms impose discipline by restricting what developers can do, ...

    linux内核设计与实现第二章文.pdf

    This separation ensures security and stability by restricting access to critical system resources. 2.4 内核假设与差异 Linux内核对底层硬件和软件环境做出多个假设。例如,它假定有一定的硬件兼容性,如...

    2021年CKS 最新大纲.docx

    Chapter 3: Restricting ServiceAccount Permissions -- RBAC 在这个章节中,我们将学习如何限制 ServiceAccount 的权限,使用 RBAC(Role-Based Access Control)来控制 Pod 的访问权限。RBAC 是 Kubernetes 中的...

Global site tag (gtag.js) - Google Analytics