oracle 密码文件

本文涉及的产品
云原生数据仓库AnalyticDB MySQL版,基础版 8ACU 100GB 1个月
简介: Oracle dba是指拥有sysdab,sysoper权限登录的用户默认为sys,system Sysdba > sys > root Sysoper > system ...

Oracle dba是指拥有sysdab,sysoper权限登录的用户默认为sys,system

Sysdba > sys > root

Sysoper > system >sudo

dba用户身份认证:操作系统身份认证,密码文件认证

[oracle@localhost ~]$ id oracle

uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)

[oracle@localhost ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 22 03:38:59 2017

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup

ORACLE instance started.

Total System Global Area  630501376 bytes

Fixed Size      2215984 bytes

Variable Size    465571792 bytes

Database Buffers   155189248 bytes

Redo Buffers      7524352 bytes

Database mounted.

Database opened.

SQL> show user;  

USER is "SYS"

删除密码文件

[oracle@localhost admin]$ cd $ORACLE_HOME/dbs

[oracle@localhost dbs]$ ls

ctl.txt      init.ora      lkORCL     spfile

hc_orcl.dat  initorcl.ora  orapworcl  spfileorcl.ora

[oracle@localhost dbs]$ rm -rf orapworcl 

使用密码文件就会报错

[oracle@localhost ~]$ sqlplus sys/oracle@orcl as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 22 03:50:28 2017

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

ERROR:

ORA-01031: insufficient privileges

Enter user-name: 

  

重建密码命令

[oracle@localhost dbs]$ orapwd file=orapworcl password=oracle entries=1

[oracle@localhost dbs]$ 

密码文件重建后,就可以正常登录,远程登录确实需要密码文件

[oracle@localhost ~]$ sqlplus sys/oracle@orcl as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 22 04:04:25 2017

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> 

密码文件认证还是操作系统认证决定

remote_login_passwordfile=none||exclusive|shared

none--不适用密码文件

execlusive--密码文件认证,自己独有使用;默认使用execlusive

share--密码文件认证,不同实例dba用户可以共享密码文件

$ORACLE_HOME/network/admin/sqlnet.ora

操作系统

SQLNET.AUTHENTICATION_SERVICES=none|all

none:关闭os认证,只能密码文件认证

all:关闭本地密码文件认证,采用操作系统认证,但是远程(异机)可以

--了解nts(windows)

组合remote_login_passwordfile和SQLNET.AUTHENTICATION_SERVICES=none|all

修改sqlnet.ora的SQLNET.AUTHENTICATION_SERVICES改为none,关闭本地连接,故使用sqlplus / as sysdba会报错,使用密码登录没有报错

[oracle@localhost admin]$ cat sqlnet.ora 

# sqlnet.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/n

etwork/admin/sqlnet.ora# Generated by Oracle configuration tools.

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

SQLNET.AUTHENTICATION_SERVICES=none

ADR_BASE = /u01/app/oracle

[oracle@localhost admin]$ 

[oracle@localhost ~]$ sqlplus sys/oracle@orcl as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 22 04:04:25 2017

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 

64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@localhost ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 22 05:06:20 2017

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

ERROR:

ORA-01031: insufficient privileges

Enter user-name: 

[oracle@localhost ~]$ sqlplus sys/oracle@orcl as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 22 05:09:34 2017

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> 

将其修改为all,关闭本地密码登录,可以使用os认证

[oracle@localhost admin]$ cat sqlnet.ora

# sqlnet.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora

# Generated by Oracle configuration tools.

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

SQLNET.AUTHENTICATION_SERVICES=all

ADR_BASE = /u01/app/oracle

[oracle@localhost admin]$ 

[oracle@localhost ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 22 05:15:11 2017

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@localhost ~]$ sqlplus sys/oracle@orcl as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 22 05:15:22 2017

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

ERROR:

ORA-12641: Authentication service failed to initialize

Enter user-name: 

密码丢失

重建命令:orapwd file=orapworcl password=oracle entries=1

[oracle@localhost admin]$ orapwd

Usage: orapwd file=<fname> entries=<users> force=<y/n> ignorecase=<y/n> nosysd

ba=<y/n>

  where

    file - name of password file (required),

    password - password for SYS will be prompted if not specified at command l

ine,    

entries - maximum number of distinct DBA (optional),

    force - whether to overwrite existing file (optional),

    ignorecase - passwords are case-insensitive (optional),

    nosysdba - whether to shut out the SYSDBA logon (optional Database Vault o

nly).    

  There must be no spaces around the equal-to (=) character.

file:密码文件名称orapw<<sid>

password:sys的密码

entries-->可以有多个sysdba,sysoperr权限用户放到密码文件中

force-->强制

entries:了解就可以

密码文件修改

sys密码修改

sysdba sysoper权限用户新增

使用命令行修改,密码文件修改

alter user sys identified by "";

SQL> alter user sys identified by oracle;

User altered.

[oracle@localhost dbs]$ strings orapworcl

]\[Z

ORACLE Remote Password file

INTERNAL

AB27B53EDC5FEF41

8A8F025737A9097A

BoY9

fa/C

SQL> alter user sys identified by dragon;

User altered.

[oracle@localhost dbs]$ strings orapworcl

]\[Z

ORACLE Remote Password file

INTERNAL

906B20769668AC39

4B68E3F33DE31745

o&tfW#\G

[oracle@localhost dbs]$ 

授权回收sysdba或者sysoper权限,修改密码文件

grant /remove  sysdba/sysoper to u

相关实践学习
AnalyticDB MySQL海量数据秒级分析体验
快速上手AnalyticDB MySQL,玩转SQL开发等功能!本教程介绍如何在AnalyticDB MySQL中,一键加载内置数据集,并基于自动生成的查询脚本,运行复杂查询语句,秒级生成查询结果。
阿里云云原生数据仓库AnalyticDB MySQL版 使用教程
云原生数据仓库AnalyticDB MySQL版是一种支持高并发低延时查询的新一代云原生数据仓库,高度兼容MySQL协议以及SQL:92、SQL:99、SQL:2003标准,可以对海量数据进行即时的多维分析透视和业务探索,快速构建企业云上数据仓库。 了解产品 https://www.aliyun.com/product/ApsaraDB/ads
目录
相关文章
|
5月前
|
存储 Oracle NoSQL
Oracle 表空间、数据文件、schema的关系
Oracle 表空间、数据文件、schema的关系
178 2
|
5月前
|
XML Java 数据库连接
struts+hibernate+oracle+easyui实现lazyout组件的简单案例——hibernate的config文件(hibernate.cfg.xml)
struts+hibernate+oracle+easyui实现lazyout组件的简单案例——hibernate的config文件(hibernate.cfg.xml)
|
1月前
|
Oracle 关系型数据库 数据库
数据库数据恢复—Oracle数据库文件出现坏块的数据恢复案例
打开oracle数据库报错“system01.dbf需要更多的恢复来保持一致性,数据库无法打开”。 数据库没有备份,无法通过备份去恢复数据库。用户方联系北亚企安数据恢复中心并提供Oracle_Home目录中的所有文件,急需恢复zxfg用户下的数据。 出现“system01.dbf需要更多的恢复来保持一致性”这个报错的原因可能是控制文件损坏、数据文件损坏,数据文件与控制文件的SCN不一致等。数据库恢复工程师对数据库文件进一步检测、分析后,发现sysaux01.dbf文件损坏,有坏块。 修复并启动数据库后仍然有许多查询报错,export和data pump工具使用报错。从数据库层面无法修复数据库。
数据库数据恢复—Oracle数据库文件出现坏块的数据恢复案例
|
10天前
|
Oracle 关系型数据库 数据库
oracle数据恢复—Oracle数据库文件损坏导致数据库打不开的数据恢复案例
打开oracle数据库时报错,报错信息:“system01.dbf需要更多的恢复来保持一致性,数据库无法打开”。急需恢复zxfg用户下的数据。 出现上述报错的原因有:控制文件损坏、数据文件损坏、数据文件与控制文件的SCN不一致等。数据恢复工程师对数据库文件做进一步检测分析后发现sysaux01.dbf文件有坏块。修复sysaux01.dbf文件,启动数据库依然有许多查询报错。export和data pump工具无法使用,查询告警日志并分析报错,确认发生上述错误的原因就是sysaux01.dbf文件损坏。由于该文件损坏,从数据库层面无法修复数据库。由于system和用户表空间的数据文件是正常的,
|
4月前
|
SQL Oracle 关系型数据库
mysql和oracle 命令行执行sql文件 数据库执行sql文件 执行sql语句
mysql和oracle 命令行执行sql文件 数据库执行sql文件 执行sql语句
67 0
|
4月前
|
存储 SQL Oracle
oracle 存储过程导出sql语句 导出为文件
oracle 存储过程导出sql语句 导出为文件
169 0
|
5月前
|
存储 监控 Oracle
Oracle数据文件:数据王国的秘密藏宝图
【4月更文挑战第19天】Oracle数据文件是数据库物理存储的核心,存储实际数据,犹如数据王国的宝藏。它们对数据库性能至关重要,影响数据分布和访问效率。有效管理数据文件涉及合理规划大小、数量,监控使用情况,利用自动扩展功能,并能实现跨磁盘存储和高可靠性。理解数据文件原理有助于优化数据库性能和资源利用,发掘更多数据潜力。
|
5月前
|
Oracle 关系型数据库 数据安全/隐私保护
oracle 19c 密码字段
oracle 19c 密码字段
60 0
|
5月前
|
运维 Oracle 关系型数据库
Oracle日志文件:数据王国的“记事本”
【4月更文挑战第19天】Oracle日志文件是数据库稳定运行的关键,记录数据变更历史,用于恢复和故障处理。它们协调并发操作,确保数据一致性和完整性。日志文件实时写入操作信息并定期刷新到磁盘,便于数据恢复。然而,日志文件需备份和归档以保证安全性,防止数据丢失。日志文件,数据王国的“记事本”,默默守护数据安全。
|
5月前
|
运维 Oracle 安全
Oracle的三重奏:密码文件、警告文件与跟踪文件
【4月更文挑战第19天】Oracle数据库的三大守护者:密码文件保护系统免受未经授权访问,如同宝藏的“密码锁”;警告文件似“哨兵”,记录错误信息,助于及时解决问题;跟踪文件扮演“侦探”角色,详尽记录操作,便于性能优化和故障排查。这三份文件共同确保数据王国的安全与稳定。作为管理员,重视并善用它们是关键。

推荐镜像

更多