oracle 密码文件

简介: Oracle dba是指拥有sysdab,sysoper权限登录的用户默认为sys,system Sysdba > sys > root Sysoper > system ...

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

Sysdba > sys > root

Sysoper > system >sudo

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

P+r0yzT8KAGcAAAAAElFTkSuQmCC

[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

相关实践学习
数据库实验室挑战任务-初级任务
本场景介绍如何开通属于你的免费云数据库,在RDS-MySQL中完成对学生成绩的详情查询,执行指定类型SQL。
阿里云云原生数据仓库AnalyticDB MySQL版 使用教程
云原生数据仓库AnalyticDB MySQL版是一种支持高并发低延时查询的新一代云原生数据仓库,高度兼容MySQL协议以及SQL:92、SQL:99、SQL:2003标准,可以对海量数据进行即时的多维分析透视和业务探索,快速构建企业云上数据仓库。 了解产品 https://www.aliyun.com/product/ApsaraDB/ads
目录
相关文章
|
18天前
|
存储 Oracle NoSQL
Oracle 表空间、数据文件、schema的关系
Oracle 表空间、数据文件、schema的关系
70 2
|
18天前
|
XML Java 数据库连接
struts+hibernate+oracle+easyui实现lazyout组件的简单案例——hibernate的config文件(hibernate.cfg.xml)
struts+hibernate+oracle+easyui实现lazyout组件的简单案例——hibernate的config文件(hibernate.cfg.xml)
14 0
|
8月前
|
Oracle 关系型数据库 数据库
9-4 Oracle管理表空间和数据文件
9-4 Oracle管理表空间和数据文件
|
12天前
|
Oracle 关系型数据库 数据安全/隐私保护
oracle 19c 密码字段
oracle 19c 密码字段
22 0
|
18天前
|
运维 Oracle 安全
Oracle的三重奏:密码文件、警告文件与跟踪文件
【4月更文挑战第19天】Oracle数据库的三大守护者:密码文件保护系统免受未经授权访问,如同宝藏的“密码锁”;警告文件似“哨兵”,记录错误信息,助于及时解决问题;跟踪文件扮演“侦探”角色,详尽记录操作,便于性能优化和故障排查。这三份文件共同确保数据王国的安全与稳定。作为管理员,重视并善用它们是关键。
|
18天前
|
运维 Oracle 关系型数据库
Oracle服务器参数文件:数据王国的“调控大师”
【4月更文挑战第19天】Oracle服务器参数文件,数据库的“调控大师”,掌控着内存管理、进程调度等关键设置。通过参数调整如SGA_MAX_SIZE和PROCESSES,实现性能优化和故障防控。虽然挑战重重,但成功的性能调优带来无尽成就感。它在备份恢复中也扮演重要角色,保障数据一致性与可用性。成为真正的“调控大师”,为数据王国效力!
|
18天前
|
运维 Oracle 关系型数据库
Oracle日志文件:数据王国的“记事本”
【4月更文挑战第19天】Oracle日志文件是数据库稳定运行的关键,记录数据变更历史,用于恢复和故障处理。它们协调并发操作,确保数据一致性和完整性。日志文件实时写入操作信息并定期刷新到磁盘,便于数据恢复。然而,日志文件需备份和归档以保证安全性,防止数据丢失。日志文件,数据王国的“记事本”,默默守护数据安全。
|
18天前
|
存储 Oracle 安全
Oracle控制文件:数据王国的导航仪
【4月更文挑战第19天】Oracle控制文件是数据库的关键组件,存储结构信息和元数据,用于数据库启动、恢复。它指引数据库找到所需文件,保证数据完整性。控制文件的多重备份和定期更新确保其安全可靠。作为数据库导航仪,它对管理员理解和维护数据库至关重要,为数据存储和恢复提供关键支持。
|
18天前
|
存储 监控 Oracle
Oracle数据文件:数据王国的秘密藏宝图
【4月更文挑战第19天】Oracle数据文件是数据库物理存储的核心,存储实际数据,犹如数据王国的宝藏。它们对数据库性能至关重要,影响数据分布和访问效率。有效管理数据文件涉及合理规划大小、数量,监控使用情况,利用自动扩展功能,并能实现跨磁盘存储和高可靠性。理解数据文件原理有助于优化数据库性能和资源利用,发掘更多数据潜力。
|
18天前
|
SQL 存储 Oracle
oracle如何定期备份数据库sql文件
【1月更文挑战第7天】oracle如何定期备份数据库sql文件
66 8