oracle笔记1
conn / as sysdba -切换到sys用户 select * from session_privs show user
---------修改 操作系统访问数据库 密码--------- 1 conn system/mamager select instance_name from v$instance;//查看实例
2 停止数据库
3 删除老密码文件pwfile
4 dos>orapwd file=%orace_home%\database\pwd+sid.ora pwassword=newpass
orapwd file=f:\oracle\ora92\database\pwdorcl.ora password ="newpwd" 5 启动数据库
-------------授权普通用户使用操作系统访问数据库---------------------- grant sysdba to scott;
conn scott/tiger
conn scott/tiger as sysdba
select * from v$pwfile_user //密码文件中用户
spfile+name.ora
在实例没启动之前运行 create pfile from spfile,会生成两个文件 spfile+name.ora init+name.ora
select × from v$parameter
col val for A30 -------------起停数据库--------------------- --启动 nomount init.ora (instance started 可以建库,可以建控制文件。。) mount controlfile(control file opened for this instance 作备份,归档之类。。) open datafile (all files opened as described by the control file for this instance 交易。。。)
shutdown innediate;关闭数据库
startup nomount;启动数据库-nomount////////////////select status form v$instance; 1,读init.ora 2,分内存。 3,分后台进程 4,建立虚表 "v$" 这些都是虚表。记录数据库状态的一些信息。 alter database mount;-读初始化参数中的控制文件///////////////select status form v$instance;
startup open = startup startup mount startup nomount --停止 help shutdown shutdown normal ------等待所有用户退出才关闭 shutdown transactions ----等待提交事务关闭 shutdown immediate 直接关,事务回退,存盘 shutdown abort 直接关 不存盘,再次启动会根据日志恢复,但会慢。
show parameter dump -----存放 诊断oracle 错误。 ----bdump(记大事。alertSID.log ) ----cdump(内存,内核错误) ----udump(客户端发生的事情)
--------------------建立数据库--------------------------------- show parameter name