Oracle OS认证口令文件密码丢失处理
Oracle安装之后默认情况下是启用了OS认证的,这里提到的OS认证是指服务器端OS认证。OS认证的意思把登录数据库的用户和口令校验放
一. OS认证
1.1 OS认证介绍
Oracle安装之后默认情况下是启用了OS认证的,这里提到的OS认证是指服务器端OS认证。OS认证的意思把登录数据库的用户和口令校验放在了操作系统一级。如果以安装Oracle时的用户登录OS,那么此时在登录Oracle数据库时不需要任何验证,如:
SQL> connect /as sysdba
已连接。
SQL> connect sys/aaa@test as sysdba
已连接。
SQL> connect sys/bbb as sysdba
已连接。
SQL> connect aaa/bbb as sysdba
已连接。
SQL> show user
SYS
SQL>
不论输入什么用户(哪怕这个用户如aaa在数据库中根本不存在),只要以sysdba权限连接数据库,都可以连接上,并且连接用户是sys,这样很方便,有时候,如果忘记了数据库的密码,而又想登录数据库,可以通过这种方式,前提是在数据库服务器上.
1.2 OS 认证相关的参数
Oracle数据库通过如下3个参数来实现OS 认证:
(1)sqlnet.ora中的 SQLNET.AUTHENTICATION_SERVICES参数。
(2)PFILE(或SPFILE)文件中的参数REMOTE_LOGIN_PASSWORDFILE
(3)口令文件PWDsid.ora(windows)或者 orapwSID(linux,大小写敏感)。
1.2.1 sqlnet.ora 文件参数
文件位置:$ORACLE_HOME/network/admin/sqlnet.ora
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
参数可以有如下值:
SQLNET.AUTHENTICATION_SERVICES=(NTS)|(NONE)
其中:
(NTS): 表示操作系统认证方式,不使用口令文件,默认值。
(NONE):口令文件认证方式
1.2.2 REMOTE_LOGIN_PASSWORDFILE 参数
该参数可以有如下值:
REMOTE_LOGIN_PASSWORDFILE ='NONE'|'EXCLUSIVE'|'SHARED'
(1)NONE:不使用密码文件登录、不允许远程用户用sys登录系统、可以在线修改sys的密码;
(2)EXCLUSIVE:默认值。只允许一个数据库使用该密码文件、允许远程登录、允许非sys用户以sysdba身份管理数据库、可以在线修改sys的密码。在这种模式下,口令文件可以包含用于多个特许的Oracle账户的口令。这是推荐的操作模式,特别是在运行RMAN时。如果希望将RMAN与来自于远程客户端的数据库连接,则必须使用该参数设置。
(3)SHARE:可以多个数据库使用密码文件。实际上是这样的: Oracle数据库在启动时,首先查找的是orapw
修改:
SQL>ALTER SYSTEM SET REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE SCOPE=SPFILE;
需要注意的是:这个参数不是动态参数。需要在数据库加载到MOUNT状态下修改,另外改变以后需要重新启动数据库,参数的设置才能够生效。
1.3 禁用OS认证
OS 认证存在一定的安全隐患,我们可以屏蔽OS认证。
1.3.1 windows下
在win下只要把oracle_home/NETWORK/admin/sqlnet.ora中的SQLNET.AUTHENTICATION_SERVICES= (nts)nts改成none或者注释掉这句话(在前面加上#),就可以屏蔽os功能,要想以sys用户连上数据库必须输入正确的sys口令,,或者可以把oracle的安装用户从组ora_dba中删除掉,当然也可以直接把ora_dba这个组也删除,都可以屏蔽os功能.
如:
SQL> connect /as sysdba
ERROR:
ORA-01031: 权限不足
SQL> connect sys/aaa as sysdba
ERROR:
ORA-01017: 用户名/口令无效; 登录被拒绝
SQL> connect aaa/bbb as sysdba
ERROR:
ORA-01031: 权限不足
SQL> connect sys/system as sysdba
已连接。
SQL>
1.3.2 LINUX/UNIX 下
在文件sqlnet.ora中增加SQLNET.AUTHENTICATION_SERVICES=(none)以及删除dba(groupdel dba)组或者把oracle用户从dba组中删除都可以屏蔽os认证。
注意:
使用这种屏蔽方法, 系统管理员还是可以创建ora_dba or dba组以及修改sqlnet.ora文件。

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



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.

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.

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.

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.

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

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

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

MySQL supports four index types: B-Tree, Hash, Full-text, and Spatial. 1.B-Tree index is suitable for equal value search, range query and sorting. 2. Hash index is suitable for equal value searches, but does not support range query and sorting. 3. Full-text index is used for full-text search and is suitable for processing large amounts of text data. 4. Spatial index is used for geospatial data query and is suitable for GIS applications.
