DBA运维工具OLazy怎么使用

发布时间:2022-10-21 14:58:25 作者:iii
来源:亿速云 阅读:136

本文小编为大家详细介绍“DBA运维工具OLazy怎么使用”,内容详细,步骤清晰,细节处理妥当,希望这篇“DBA运维工具OLazy怎么使用”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。

OLazy说明

OLazy工具是辅助、帮助简化DBA运维工具,将日常用到的众多命令集于一身,DBA只需要敲简单的命令即可查看相应的数据,如:tbs:查看表空间相关信息。

其主要特性是无客户端方式,无需部署在数据库服务器上。

该脚本是通过Python开发。

支持11g及以上版本

如需要Q:785165816

工具部分截图

OLazy> help

用法:
Lazy 命令 参数1 参数2 
注意:首次使用必须初始化(init)并添加数据库配置信息
---------------------------------------------------------------------------------------------
  init                                                                  --初始化表结构
  get_session_of_sid 或  gsos                                            --根据SID查看会话信息
  standby_archive_dest 或  sad                                           --查看备库的归档路径信息
  backup_set_info 或  bsi                                                --查看RMAN备份集信息
  rman_session 或  rmans                                                 --查看正在运行的RMAN会话信息
  list_backup 或  lbak                                                   --查看最近10天的RMAN备份信息
  table_frag 或  tf                                                      --查看表的碎片程度
  user_role_privs  或  urp                                               --查看用户/角色的权限
  undo_advice  或  ua                                                    --Undo优化助手
  flash_recovery_area_usage  或  frau                                    --查看快速恢复区使用情况
  profile  或  pf                                                        --查看数据库Profile配置
  instance_efficiency  或  ie                                            --查看实例命中率
  archivelog_size  或  als                                               --查看最近10天的归档日志大小
  unbind_sql  或  us                                                     --查看TOP 10 非绑定变量SQL
  diskreads_sql  或  ds                                                  --查看TOP 10 物理读SQL
  logicalreads_sql  或  lrs                                              --查看TOP 10 逻辑读SQL
  elapsed_sql  或  es                                                    --查看TOP 10运行时间SQL
  db_patch  或  dbp                                                      --查看数据库PATCH信息
  db_growth  或  dbg                                                     --查看数据库大小增长情况
  high_freq_sql  或  hfs                                                 --查看TOP 10执行频率高的SQL
  rollback_trans  或  rt                                                 --查看使用回滚段的会话
  rollback_session  或  rs                                               --查看使用回滚段的事务
  sort_sql  或  ss                                                       --查看TOP 10排序高的SQL
  buffer_pool_hit  或  bph                                               --查看缓冲区命中率
  dict_hit  或  dh                                                       --查看数据字典命中率
  full_scan  或  fs                                                      --查看全表扫描SQL
  version_sql  或  vs                                                    --查看TOP 10 高版本SQL
  rollback_segs  或  rs                                                  --查看无效对象
  invalid_object  或  io                                                 --查看无效对象
  invalid_job  或  ij                                                    --查看无效JOB
  user_info  或  ui                                                      --查看用户信息,如:默认表空间、状态
  auto_task  或  at                                                      --自动维护任务状态
  pdb_info  或  pi                                                       --查看PDB容器信息
  sga_usage  或  su                                                      --SGA使用情况
  index_health  或  ih                                                   --索引健康检查
  index_monitor  或  im                                                  --监控索引使用情况
  hot_table  或  ht                                                      --查看TOP 10热表(按插入次数排序)
  invalid_index  或  ii                                                  --查看无效索引
  db_option  或  do                                                      --查看数据库组件安装情况
  db_registry  或  dr                                                    --查看数据库已安装的组件状态
  sysmetric_summary  或  ss                                              --查看相邻两次快照之间的DB TIME、Elapsed time
  host  或  h                                                            --查看数据库、主机状态
  addhost  或  ah                                                        --新增数据库、主机
  lshost  或  ls                                                         --查看已配置数据库、主机信息
  rmhost  或  rm                                                         --删除指定数据库、主机信息
  reconfig  或  re                                                       --修改指定数据库、主机配置信息
  active                                                                --查看活动会话
  session_total                                                         --查看活动会话数
  dbs                                                                   --查看数据库的TPS/QPS/负载/物理读
  sqltext [sql_id]                                                      --根据sql_id获取sql语句
  param [pattern]                                                       --查看初始化参数
  _param [pattern]                                                      --查看隐藏参数
  event                                                                 --查看等待事件
  invalid [owner]                                                       --查看无效对象
  desc tabname [owner]                                                  --查看表结构
  datafile                                                              --查看数据文件
  tablespace                                                            --查看表空间信息
  running_sql                                                           --查看正在执行的相同sql数量
  size segname [owner]                                                  --查看表/索引大小
  idxdesc    tabname owner                                              --查看索引结构
  allsqltext                                                            --查看所有正在执行的sql
  lock       [sid]                                                      --根据sid获取锁信息
  lockwait                                                              --查看锁的堵塞用户和被堵塞用户
  objlike    pattern [owner]                                            --模糊查看对象名
  tstat      tabname owner                                              --查看表统计信息
  istat      tabname owner                                              --查看索引统计信息
  ipstat     indname owner                                              --查看分区索引信息
  longops                                                               --查看长时间运行的会话
  depend     objname [owner]                                            --查看对象的主外键关系
  hold                                                                  --查看锁的持有者
  segment    [size]                                                     --查看指定大小的段信息
  tabpart    tabname [owner]                                            --查看表分区
  objsql     objname owner                                              --查看涉及到某个对象的sql语句
  unusable   [owner]                                                    --查看没有使用的索引
  ddl        owner object_type name                                     --查看对象的创建语句(DDL)
  get_kill_sh sql_id username                                           --获取kill会话的shell命令
  snapshot  或  ss                                                       --查看快照
  createsnapshot  或  css                                                --创建快照
  dropsnapshot  或  dss [days]                                           --删除快照
  awr                                                                   --自动在本地生成AWR报告
  tsfree                                                                --查看表空间使用率
  stopmrp  或 spm                                                        --停止Standby MRP进程
  startmrp  或 stm                                                       --启动Standby MRP进程
  mrp                                                                   --查看Standby 进程
  gap                                                                   --查看GAP信息
  archivelog_applied 或 aa                                               --查看归档日志应用情况
  redo_freq                                                             --查看REDO切换频率
  resource_usage 或 ru                                                   --查看资源使用情况
  default_tablespace 或 dt                                               --查看用户的默认表空间
  diskgroup 或 dg                                                        --查看磁盘组信息
  diskgroup_attribute 或 da                                              --查看磁盘组属性信息
  crs                                                                   --查看crs服务状态
  votedisk                                                              --查看votedisk状态
  crs_stat_res 或 csr                                                    --查看CRS资源状态
  dg_lag 或 lag                                                          --查看standby 延迟
  db_summary 或 dbs                                                       --查看数据库概要信息
  os_summary 或 oss                                                       --查看操作系统概要信息
  server_summary 或 ss                                                   --查看服务器概要信息
  control_file 或 cf                                                     --查看控制文件信息
  top_mem_process 或 tmp                                                 --查看操作系统消耗内存TOP 10进程
  top_cpu_process 或 tcp                                                 --查看操作系统消耗CPUTOP 10进程
  run_o_sql 或 ros                                                       --执行指定的SQL查询语句
  run_linux_cmd 或 rlc                                                   --执行指定的操作系统命令
---------------------------------------------------------------------------------------------

示例

OLazy> dbs
+----+----------------+---------+----------+---------+---------+---------+---------+---------+------------+---------+------------------+
| ID | IP             | OS_TYPE | SSH_PORT | OS_USER | DB_TYPE | DB_ROLE | DB_USER | DB_NAME | DB_VERSION | DB_PORT |     COMMONT      |
+----+----------------+---------+----------+---------+---------+---------+---------+---------+------------+---------+------------------+
| 2  | 192.168.0.145  | linux   | root     | 52312   | oracle  | PRIMARY | sys     | orcl    | 11         | 1521    | develop database |
| 5  | 172.16.100.11  | linux   | root     | 8345    | oracle  | STANDBY | sys     | orcl    | 11         | 1521    | standby databse  |
| 6  | 172.17.100.6   | linux   | root     | 1912    | oracle  |   RAC   | sys     | orcl1   | 11         | 1521    | product database |
| 8  | 134.175.97.121 | linux   | root     | 1912    | oracle  | PRIMARY | sys     | helowin | 11         | 1521    |   Tencent yun    |
| 10 | 172.16.100.190 | Linux   | root     | 22      | ORACLE  | primary | sys     | LEI     | 19         | 1521    |    Docker 19c    |
+----+----------------+---------+----------+---------+---------+---------+---------+---------+------------+---------+------------------+
请输入需要修改的IP对应ID:10
+------------------------------+-----------------------------------------+
| Items                        |                  VALUE                  |
+------------------------------+-----------------------------------------+
| Host IP                      |              172.16.100.190             |
| Open Mode                    |                READ WRITE               |
| DB Version                   |                  19.0.0                 |
| Log Mode                     |               NOARCHIVELOG              |
| Nls Characterset             |                 AL32UTF8                |
| Nls Nchar Characterset       |                AL16UTF16                |
| Uptime/sysdate/Time Zone     | 2020-01-08 (星期三) 02:27:01 上午+00:00 |
| HostName                     |               6a5cd3f9fb6c              |
| DB Name                      |                   LEI                   |
| Instance Name                |                   LEI                   |
| Instance Number              |                    1                    |
| DBID                         |                2212487362               |
| Global Name                  |                   LEI                   |
| Platform Name                |             Linux x86 64-bit            |
| Flashback On                 |                    NO                   |
| Cluster Database             |                  FALSE                  |
| DG                           |                    0                    |
| Database Role                |                 PRIMARY                 |
| Cluster Database Instances   |                    1                    |
| Thread#                      |                    1                    |
| Startup Time                 |           2020-01-08 01:59:00           |
| Block Size                   |                   8192                  |
| Uptime                       |          28 minutes, 5 seconds          |
| SCN Headroom                 |                 11911.1                 |
| Compatible                   |                  19.0.0                 |
| DB Created                   |           2020-01-08 01:42:26           |
| SGA Target                   |                   2 GB                  |
| Tablespace Nums              |                    5                    |
| DB Time Zone                 |                  +00:00                 |
| Default temp Tablespace      |                   TEMP                  |
| Default Permanent Tablespace |                  USERS                  |
| Undo Tablespace              |                 UNDOTBS1                |
| Total Users                  |                    36                   |
| Total DB Sizes               |                 1.68 GB                 |
| CDB?                         |                   YES                   |
| NUMBER OF PDBS               |                    1                    |
+------------------------------+-----------------------------------------+
OLazy> ss
+----+----------------+---------+----------+---------+---------+---------+---------+---------+------------+---------+------------------+
| ID | IP             | OS_TYPE | SSH_PORT | OS_USER | DB_TYPE | DB_ROLE | DB_USER | DB_NAME | DB_VERSION | DB_PORT |     COMMONT      |
+----+----------------+---------+----------+---------+---------+---------+---------+---------+------------+---------+------------------+
| 2  | 192.168.0.145  | linux   | root     | 52312   | oracle  | PRIMARY | sys     | orcl    | 11         | 1521    | develop database |
| 5  | 172.16.100.11  | linux   | root     | 8345    | oracle  | STANDBY | sys     | orcl    | 11         | 1521    | standby databse  |
| 6  | 172.17.100.6   | linux   | root     | 1912    | oracle  |   RAC   | sys     | orcl1   | 11         | 1521    | product database |
| 8  | 134.175.97.121 | linux   | root     | 1912    | oracle  | PRIMARY | sys     | helowin | 11         | 1521    |   Tencent yun    |
| 10 | 172.16.100.190 | Linux   | root     | 22      | ORACLE  | primary | sys     | LEI     | 19         | 1521    |    Docker 19c    |
+----+----------------+---------+----------+---------+---------+---------+---------+---------+------------+---------+------------------+
请输入需要修改的IP对应ID:10
+---------------------------------+-------------------------------------------+
| Items                           |                   Value                   |
+---------------------------------+-------------------------------------------+
| Server Model                    |          VMware Virtual Platform          |
| Manufacturer                    |                VMware,Inc.                |
| Serial                          |  VMware-421d63e1ad61e5a4-811fb4e988255830 |
| BIOS                            |       Phoenix Technologies LTD/6.00       |
| CPU_MODE                        | Intel(R) Xeon(R) CPU E7-4820 v4 @ 2.00GHz |
| 64 bit                          |                    YES                    |
| Maximum Memory Capacity         |                    33GB                   |
| MemTotal                        |                   31 GB                   |
| Total Memory slots/unused slots |                  160/126                  |
| Memory Speed                    |                  Unknown                  |
| Memory Model                    |                                           |
+---------------------------------+-------------------------------------------+
OLazy> 
OLazy> OSS
+----+----------------+---------+----------+---------+---------+---------+---------+---------+------------+---------+------------------+
| ID | IP             | OS_TYPE | SSH_PORT | OS_USER | DB_TYPE | DB_ROLE | DB_USER | DB_NAME | DB_VERSION | DB_PORT |     COMMONT      |
+----+----------------+---------+----------+---------+---------+---------+---------+---------+------------+---------+------------------+
| 2  | 192.168.0.145  | linux   | root     | 52312   | oracle  | PRIMARY | sys     | orcl    | 11         | 1521    | develop database |
| 5  | 172.16.100.11  | linux   | root     | 8345    | oracle  | STANDBY | sys     | orcl    | 11         | 1521    | standby databse  |
| 6  | 172.17.100.6   | linux   | root     | 1912    | oracle  |   RAC   | sys     | orcl1   | 11         | 1521    | product database |
| 8  | 134.175.97.121 | linux   | root     | 1912    | oracle  | PRIMARY | sys     | helowin | 11         | 1521    |   Tencent yun    |
| 10 | 172.16.100.190 | Linux   | root     | 22      | ORACLE  | primary | sys     | LEI     | 19         | 1521    |    Docker 19c    |
+----+----------------+---------+----------+---------+---------+---------+---------+---------+------------+---------+------------------+
请输入需要修改的IP对应ID:10
+--------------+-------------------------------------------+
| Items        |                   Value                   |
+--------------+-------------------------------------------+
| OS           |                 GNU/Linux                 |
| OS Release   |   CentOS Linux release 7.6.1810 (Core)    |
| Kernel       |           3.10.0-957.el7.x86_64           |
| HostName     |                   docker                  |
| CPU Model    | Intel(R) Xeon(R) CPU E7-4820 v4 @ 2.00GHz |
| Memory       |                  31.26 GB                 |
| Selinux      |                  enabled                  |
| LANG         |                zh_CN.UTF-8                |
| Current Time |            2020-01-08 10:31:04            |
| Last Reboot  |                   10:02                   |
| Uptime       |       5 days, 28 minutes, 25 seconds      |
| Inernet?     |                    YES                    |
| Firewall?    |                  Running                  |
+--------------+-------------------------------------------+

读到这里,这篇“DBA运维工具OLazy怎么使用”文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注亿速云行业资讯频道。

推荐阅读:
  1. 自动运维工具ansible
  2. 系统批量运维工具paramiko

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

dba

上一篇:如何用c语言代码将大写字母转成小写字母

下一篇:怎么用python代码实现99乘法表

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》