• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • MsSql
  • Mysql
  • oracle
  • MariaDB
  • DB2
  • SQLite
  • PostgreSQL
  • MongoDB
  • Redis
  • Access
  • 数据库其它
  • sybase
  • HBase
您的位置:首页 > 数据库 >Mysql > oracle dba 应该熟悉的命令

oracle dba 应该熟悉的命令

作者:匿名 字体:[增加 减小] 来源:互联网 时间:2018-12-05

匿名通过本文主要向大家介绍了oracle,dba等相关知识,希望本文的分享对您有所帮助

oracle dba 命令集合,非常的多啊,好东西。

1 运行SQLPLUS工具
sqlplus

2 以OS的默认身份连接
/ as sysdba

3 显示当前用户名
show user

4 直接进入SQLPLUS命令提示符
sqlplus /nolog

5 在命令提示符以OS身份连接
connect / as sysdba

6 以SYSTEM的身份连接
connect system/xxxxxxx@服务名

7 显示当然用户有哪些表
select * from tab;

8 显示有用户名和帐户的状态
select username,account_status from dba_users;

9 将SCOTT帐号解锁(加锁)
alter user scott account unlock(lock);

10 以SCOTT的身份连接并且查看所属表
connect scott/tiger
select * from tab;


11 查看EMP的表结构及记录内容
desc emp
select empno,ename from emp;

12 以OS的身份登看SGA,共享池,CACHE的信息
connect / as sysdba
show sga
select name,value/1024/1024 from v$sga;
show parameter shared_pool_size
select value/1024/1024 from v$parameter where name ='shared_pool_size';
show parameter db_cache_size
select value/1024/1024 from v$parameter where name ='db_cache_size';

13 查看所有含有SIZE的信息
show parameter size
bitmap_merge_area_size integer 1048576
create_bitmap_area_size integer 8388608
db_16k_cache_size big integer 0
db_2k_cache_size big integer 0
db_32k_cache_size big integer 0
db_4k_cache_size big integer 0
db_8k_cache_size big integer 0
db_block_size integer 4096
db_cache_size big integer 33554432
db_keep_cache_size big integer 0
db_recycle_cache_size big integer 0

NAME TYPE VALUE
------------------------------------ ----------- -------------
global_context_pool_size string
hash_area_size integer 1048576
java_max_sessionspace_size integer 0
java_pool_size big integer 33554432
large_pool_size big integer 8388608
max_dump_file_size string UNLIMITED
object_cache_max_size_percent integer 10
object_cache_optimal_size integer 102400
olap_page_pool_size integer 33554432
oracle_trace_collection_size integer 5242880
parallel_execution_message_size integer 2148

NAME TYPE VALUE
------------------------------------ ----------- -------------
sga_max_size big integer 143727516
shared_pool_reserved_size big integer 2516582
shared_pool_size big integer 50331648
sort_area_retained_size integer 0
sort_area_size integer 524288
workarea_size_policy string AUTO


14 显示SGA的信息
select * from v$sgastat;
POOL NAME BYTES
----------- -------------------------- ----------
fixed_sga 453532
buffer_cache 33554432
log_buffer 656384
shared pool subheap 46884
shared pool KGK heap 3756
shared pool KQR M PO 586792
shared pool KQR S PO 180232
shared pool KQR S SO 5128
shared pool sessions 410720
shared pool sql area 2144664
shared pool 1M buffer 2098176

POOL NAME BYTES
----------- -------------------------- ----------
shared pool KGLS heap 901756
shared pool parameters 8352
shared pool free memory 38687204
shared pool PL/SQL DIANA 420816
shared pool FileOpenBlock 695504
shared pool PL/SQL MPCODE 135692
shared pool library cache 2985576
shared pool miscellaneous 4889396
shared pool MTTR advisory 21164
shared pool PLS non-lib hp 2068
shared pool XDB Schema Cac 4966300

POOL NAME BYTES
----------- -------------------------- ----------
shared pool joxs heap init 4220
shared pool kgl simulator 563260
shared pool sim memory hea 44184
shared pool table definiti 1728
shared pool trigger defini 1896
shared pool trigger inform 1140
shared pool trigger source 448
shared pool type object de 69120
shared pool Checkpoint queue 282304
shared pool VIRTUAL CIRCUITS 265160
shared pool dictionary cache 1610880

POOL NAME BYTES
----------- -------------------------- ----------
shared pool KSXR receive buffers 1033000
shared pool character set object 323724
shared pool FileIdentificatonBlock 323292
shared pool message pool freequeue 834752
shared pool KSXR pending messages que 841036
shared pool event statistics per sess 1718360
shared pool fixed allocation callback 180
large pool free memory 8388608
java pool free memory 33554432

已选择42行。

15 显示PGA的信息
select * from v$pgastat;
NAME VALUE UNIT
---------------------------------------------------------------- ---------- ---------
aggregate PGA target parameter 16777216 bytes
aggregate PGA auto target 7640064 bytes
global memory bound 838656 bytes
total PGA inuse 8293376 bytes
total PGA allocated 13106176 bytes
maximum PGA allocated 22090752 bytes
total freeable PGA memory 0 bytes
PGA memory freed back to OS 0 bytes
total PGA used for auto workareas 0 bytes
maximum PGA used for auto workareas 4096 bytes
total PGA used for manual workareas 0 bytes

NAME VALUE UNIT
---------------------------------------------------------------- ---------- ---------
maximum PGA used for manual workareas 4096 bytes
over allocation count 0
bytes processed 8783872 bytes
extra bytes read/written 0 bytes
cache hit percentage 100 percent

已选择16行。

17 在$ORACLE_HOME/sqlplus/admin/glogin.sql中加入环境变量,以后每次启动生效
define _editor=vi
set line 2000


18 将当前命令随加到文件中
save c:a.sql append

19 将指定文件的命读出缓冲区
get c:a.sql

20 执行脚本语句
@ c:a.sql

21 将输入保存到指定文件中
spool c:O.LOG
select * from v$sga;
spool off

22 设定行大小
set linesize 2000

23 设定页大小
set pagesize 10

24 设定字符列格式
col ename format a30

25 设定数字列格式
col sal format 999,999.999

26 10G查看文件$ORACLE_HOME/install/protlist显示端口
http://127.0.0.1:5560/isqlplus
9i查看文件$ORACLE_HOME/Apache/Apache/ports.ini显示端口
http://127.0.0.1:7778/isqlplus
http://127.0.0.1:7778/isqlplusdba

27 启动Oracle 9i监听程序
Oracle的监听程序主要是为客户端的连接提供接口
$ lsnrctl start

28 关闭Oracle 9i监听程序
$ lsnrctl stop

29 启动Oracle Web Server
$ cd $ORACLE_HOME/Apache/Apache/bin
$ ./startJServ.sh
/database/oracle/product/9i/Apache/Apache/bin/apachectl start: httpd started

30 关闭Oracle Web Server
$ cd $ORACLE_HOME/Apache/Apache/bin
$ ./stopJServ.sh
/database/oracle/product/9i/Apache/Apache/bin/apachectl stop: httpd stopped

31 启动Oracle Web Server后默认的端口号是7777
unix
cd $ORACLE_HOME/Apache/Apache/bin/
htpasswd $ORACLE_HOME/sqlplus/admin/iplusdba.pw admin
windows
cd D:oracleora92ApacheApachebin
htpasswd D:oracleora92/sqlplus/admin/iplusdba.pw admin
New password: *****
Re-type new password: *****
Adding password for user admin

32 pfile: $ORACLE_BASE/admin/实例名/Pfile
spfile: $ORACLE_HOME/dbs
监听器配置文件:listener.ora: $ORACLE_HOME/network/admin/
tnsnames.ora: $ORACLE_HOME/network/admin/

33 指定用户的表空间
SELECT DEFAULT_TABLESPACE FROM DBA_USERS WHERE USERNAME='用户名'


34 当前用户
select user from dual;show user

35 当前用户的缺省表空间
SELECT DEFAULT_TABLESPACE FROM DBA_USERS WHERE USERNAME=(select user from dual);

37 显示正在使用的初始化参数文件
show parameter spfile

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string %ORACLE_HOME%DATABASESPFILE%
ORACLE_SID%.ORA
38 用SPfile转Pfile
create pfile='c:init.ora' from spfile;
create pfile from spfile;
UNIX将生成在$ORACLE_HOME/dbs目录下
WINDOWS将生成在$ORACLE_HOME/DATABASE目录下

39 显示cache的值
show parameter cache
前面两个下划线的是动态调整的参数
前面一个下划线的是内部参数

40 显
分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • 浅析drop user与delete from mysql.user的区别
  • mysql prompt的用法详解
  • 如何使用索引提高查询速度
  • 深入mysql创建自定义函数与存储过程的详解
  • JDBC数据库的使用操作总结
  • MySQL查询优化:LIMIT 1避免全表扫描提高查询效率
  • MySQL与Oracle的语法区别详细对比
  • 有关mysql中ROW_COUNT()的小例子
  • MySQL 百万级分页优化(Mysql千万级快速分页)
  • 从创建数据库到存储过程与用户自定义函数的小感

相关文章

  • 2018-12-05SQLServer 优化SQL语句 in 和not in的替代方案
  • 2018-12-05Oracle启动时出现ORA-32004报错的解决方法
  • 2018-12-05mysql中order by in 的字符顺序(推荐)
  • 2017-05-11mysql中判断记录是否存在方法比较
  • 2018-12-05mysql进阶(十八)完全卸载mysql数据库图文教程
  • 2018-12-05mysql 记录不存在时插入 记录存在则更新的实现方法
  • 2018-12-05Oracle 数据库连接查询SQL语句
  • 2018-12-05总结关于数据库、表注意点
  • 2018-12-05mysql 协议的ResultsetRow包及解析
  • 2018-12-05如何在Linux下安装和配置PHPmyadmin?

文章分类

  • MsSql
  • Mysql
  • oracle
  • MariaDB
  • DB2
  • SQLite
  • PostgreSQL
  • MongoDB
  • Redis
  • Access
  • 数据库其它
  • sybase
  • HBase

最近更新的内容

    • Oracle 下的开发日积月累_Oracle应用_脚本之家
    • 探秘mysql中的timeout
    • MySQL中批量删除指定前缀表的sql语句
    • MySQL 主键与索引的联系与区别分析
    • 详解mysql是怎么备份脚本的
    • 分享MySQL 中的共享锁和排他锁的用法
    • SqlServer 索引自动优化工具
    • 3种高效的Tags标签系统数据库设计方案分享
    • mysql生成随机字符串函数分享
    • mysql中int、bigint、smallint 和 tinyint的区别详细介绍

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有