关于sysdba,sysoper,dba的区别
关于sysdba,sysoper,dba这些名词在工作中可能接触的比较多,如果接触的环境是服务器端的,sysdba可能是经常用到的。如果是数据库
关于sysdba,sysoper,dba这些名词在工作中可能接触的比较多,如果接触的环境是服务器端的,sysdba可能是经常用到的。如果是数据库的维护工作,dba就是必备的权限。
在Oracle的官方文档中给出了sysdba和sysoper的区别。我在这个基础上又加入了一些东西做点补充。
标黄的部分是sysdba和sysoper的不同之处。这两个特殊的系统权限和dba权限还是有着明显的差别。
System PrivilegeOperations Authorized
SYSDBA
ALTER DATABASE: open, mount, back up, or change character set
CREATE DATABASE
DROP DATABASE
CREATE SPFILE
ALTER DATABASE ARCHIVELOG
ALTER DATABASE RECOVER
Includes the RESTRICTED SESSION privilege
Effectively, this system privilege allows a user to connect as user SYS.
SYSOPER
CREATE SPFILE
ALTER DATABASE OPEN/MOUNT/BACKUP
ALTER DATABASE ARCHIVELOG
ALTER DATABASE RECOVER (Complete recovery only. Any form of incomplete recovery, such as UNTIL TIME|CHANGE|CANCEL|CONTROLFILE requires connecting as SYSDBA.)
Includes the RESTRICTED SESSION privilege
#1 sys,system用户都是数据库创建时内置的用户。sys绑定的是sysdba系统权限,system绑定的是dba角色。
sys的默认密码是CHANGE_ON_INSTALL,而system的默认密码是MANAGER
#2 如果直接拿sys来登录,不使用sysdba,会有下面的错误。
[ora11g@rac1 ~]$ sqlplus sys/oracle
SQL*Plus: Release 11.2.0.3.0 Production on Sat Nov 22 04:39:21 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-28009: connection as SYS should be as SYSDBA or SYSOPER
#3 sysdba对应的用户时SYS,而sysoper对应的用户PUBLIC
SQL> conn / as sysoper
Connected.
SQL> show user
USER is "PUBLIC"
SQL> conn / as sysdba
Connected.
SQL> show user
USER is "SYS"
#4 如果在服务端登录,随便用一个用户。因为设置了操作系统级的验证,所以都可以使用sysdba.
SQL> conn test/test as sysdba
Connected.
如果使用了tns连接的情况下。就会校验test的权限。发现不具备sysdba的系统权限。
SQL> conn test/tets@test01 as sysdba
ERROR:
ORA-01031: insufficient privileges
#5 关于sys,不得不提到密码文件。如果没有密码文件。会报如下的错误。
[ora11g@rac1 dbs]$ sqlplus sys/oracle@test01 as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sat Nov 22 05:40:03 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-01031: insufficient privileges
创建了密码文件之后,就没有问题
[ora11g@rac1 dbs]$ orapwd password=oracle file=orapwTEST01 entries=2
[ora11g@rac1 dbs]$ sqlplus sys/oracle@test01 as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sat Nov 22 05:40:37 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> exit
#6 关于sysdba和dba的区别,可以通过如下的例子来简单示范一下。
用户n1是dba用户。我们使用sysdba和dba权限的时候来看一下不同之处。
[ora11g@rac1 dbs]$ sqlplus n1/n1 as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sat Nov 22 05:56:40 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select count(*)from cat;
COUNT(*)
----------
4809
SQL> conn n1/n1
Connected.
SQL> select count(*)from cat;
COUNT(*)
----------
406
#7 sysdba具有的权限要远大于dba。我们平常使用的dba角色主要包括创建表,视图,索引等等的明细权限,,但是sysdba可以做数据库级的任何操作。
在CentOS 6.4下安装Oracle 11gR2(x64)
Oracle 11gR2 在VMWare虚拟机中安装步骤
本文永久更新链接地址:

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

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

Hot Topics











The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

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 index cardinality has a significant impact on query performance: 1. High cardinality index can more effectively narrow the data range and improve query efficiency; 2. Low cardinality index may lead to full table scanning and reduce query performance; 3. In joint index, high cardinality sequences should be placed in front to optimize query.

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

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

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.

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.
