集群及oracle简单维护
1.1 --查看用户列表
select username from dba_users
1.2 --更改用户密码
alter user 用户名 identified by 密码;
1.3 --查询默认密码过期时间
SELECT * FROM dba_profiles WHERE profile='DEFAULT' AND resource_name='PASSWORD_LIFE_TIME';
1.4 --查询系统用户所使用的proifle
SELECT username,PROFILE FROM dba_users;
1.5 查询asm磁盘空间使用率
select group_number,name,total_mb,free_mb from v$asm_diskgroup;
1.6 --修改所有用户的密码过期时间为无限制
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;打开命令窗口
1.7 --给scott用户解锁
sql>alter user scott account unlock
1.8 --按百分比查询表空间大小
SELECT A.TABLESPACE_NAME,A.BYTES TOTAL,B.BYTES USED, C.BYTES FREE,
(B.BYTES*100)/A.BYTES "% USED",(C.BYTES*100)/A.BYTES "% FREE"
FROM SYS.SM$TS_AVAIL A,SYS.SM$TS_USED B,SYS.SM$TS_FREE C
WHERE A.TABLESPACE_NAME=B.TABLESPACE_NAME AND A.TABLESPACE_NAME=C.TABLESPACE_NAME;
1.9 --查询表空间路径
select t1.name, t2.name
from v$tablespace t1, v$datafile t2
where t1.ts# = t2.ts#;
1.10 扩表空间
用户 路径 新增加文件名 大小
ALTER TABLESPACE TDS ADD DATAFILE '+ORADATA/ucit/datafile/tds01.dbf' SIZE 4000M AUTOEXTEND ON;
自动扩展
1.11 Rac维护
查看共享磁盘
(正常状态)
[root@ucitrac1 bin]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 1.6T 0 disk
├─sda1 8:1 0 199.9M 0 part /boot/efi
├─sda2 8:2 0 500.1M 0 part /boot
└─sda3 8:3 0 1.6T 0 part
├─VolGroup-lv_root (dm-0) 253:0 0 1.5T 0 lvm /
├─VolGroup-lv_swap (dm-1) 253:1 0 64G 0 lvm [SWAP]
└─VolGroup-lv_home (dm-3) 253:3 0 50G 0 lvm /home
sdb 8:16 0 10.7T 0 disk
└─oraclerac (dm-2) 253:2 0 10.7T 0 mpath
├─asmvg-lv_ocr1 (dm-4) 253:4 0 10G 0 lvm
├─asmvg-lv_ocr2 (dm-5) 253:5 0 10G 0 lvm
├─asmvg-lv_ocr3 (dm-6) 253:6 0 10G 0 lvm
├─asmvg-lv_data1 (dm-7) 253:7 0 1000G 0 lvm
├─asmvg-lv_data2 (dm-8) 253:8 0 1000G 0 lvm
├─asmvg-lv_data3 (dm-9) 253:9 0 1000G 0 lvm
├─asmvg-lv_data4 (dm-10) 253:10 0 1000G 0 lvm
├─asmvg-lv_data5 (dm-11) 253:11 0 1000G 0 lvm
├─asmvg-lv_bak1 (dm-12) 253:12 0 1.1T 0 lvm
├─asmvg-lv_bak2 (dm-13) 253:13 0 1.1T 0 lvm
├─asmvg-lv_bak3 (dm-14) 253:14 0 1.1T 0 lvm
├─asmvg-lv_bak4 (dm-15) 253:15 0 1.1T 0 lvm
└─asmvg-lv_bak5 (dm-16) 253:16 0 1.1T 0 lvm
sdc 8:32 0 10.7T 0 disk
└─oraclerac (dm-2) 253:2 0 10.7T 0 mpath
├─asmvg-lv_ocr1 (dm-4) 253:4 0 10G 0 lvm
├─asmvg-lv_ocr2 (dm-5) 253:5 0 10G 0 lvm
├─asmvg-lv_ocr3 (dm-6) 253:6 0 10G 0 lvm
├─asmvg-lv_data1 (dm-7) 253:7 0 1000G 0 lvm
├─asmvg-lv_data2 (dm-8) 253:8 0 1000G 0 lvm
├─asmvg-lv_data3 (dm-9) 253:9 0 1000G 0 lvm
├─asmvg-lv_data4 (dm-10) 253:10 0 1000G 0 lvm
├─asmvg-lv_data5 (dm-11) 253:11 0 1000G 0 lvm
├─asmvg-lv_bak1 (dm-12) 253:12 0 1.1T 0 lvm
├─asmvg-lv_bak2 (dm-13) 253:13 0 1.1T 0 lvm
├─asmvg-lv_bak3 (dm-14) 253:14 0 1.1T 0 lvm
├─asmvg-lv_bak4 (dm-15) 253:15 0 1.1T 0 lvm
└─asmvg-lv_bak5 (dm-16) 253:16 0 1.1T 0 lvm
查看集群状态
(正常状态)
[root@ucitrac1 bin]# su – grid
[grid@ucitrac1 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....ER.lsnr ora....er.type ONLINE ONLINE ucitrac1
ora....N1.lsnr ora....er.type ONLINE ONLINE ucitrac1
ora.OCR.dg ora....up.type ONLINE ONLINE ucitrac1
ora.ORABAK.dg ora....up.type ONLINE ONLINE ucitrac1
ora.ORADATA.dg ora....up.type ONLINE ONLINE ucitrac1
ora.asm ora.asm.type ONLINE ONLINE ucitrac1
ora.cvu ora.cvu.type ONLINE ONLINE ucitrac1
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE ucitrac1
ora.oc4j ora.oc4j.type ONLINE ONLINE ucitrac1
ora.ons ora.ons.type ONLINE ONLINE ucitrac1
ora.scan1.vip ora....ip.type ONLINE ONLINE ucitrac1
ora.ucit.db ora....se.type ONLINE ONLINE ucitrac1
ora....SM1.asm application ONLINE ONLINE ucitrac1
ora....C1.lsnr application ONLINE ONLINE ucitrac1
ora....ac1.gsd application OFFLINE OFFLINE
ora....ac1.ons application ONLINE ONLINE ucitrac1
ora....ac1.vip ora....t1.type ONLINE ONLINE ucitrac1
ora....SM2.asm application ONLINE ONLINE ucitrac2
ora....C2.lsnr application ONLINE ONLINE ucitrac2
ora....ac2.gsd application OFFLINE OFFLINE
ora....ac2.ons application ONLINE ONLINE ucitrac2
ora....ac2.vip ora....t1.type ONLINE ONLINE ucitrac2
查看单节点集群服务状态
先查看grid路径
[grid@ucitrac1 ~]$ cd $ORACLE_HOME
[grid@ucitrac1 grid]$ pwd
/u01/app/11.2.0/grid
[grid@ucitrac1 grid]$ cd bin
[grid@ucitrac1 bin]$ pwd
/u01/app/11.2.0/grid/bin
[grid@ucitrac1 bin]$
查看状态(如果三个都是online 状态表示正常,如果不是那就是有问题)
[root@ucitrac1 bin]# ./crsctl check cluster
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
启动单节点crs
[root@ucitrac1 bin]# ./crsctl start crs
停止单节点
[root@ucitrac1 bin]# ./crsctl stop crs
版权声明:
作者:SE_You
链接:https://www.cnesa.cn/1139.html
来源:CNESA
文章版权归作者所有,未经允许请勿转载。
共有 0 条评论