In an Oracle RAC cluster, there are also issues with owners and permissions for the management of various resources. Crs_getperm and crs_setperm are such a pair of commands, mainly used to view and modify resource in the cluster owner,group and permissions, and so on, the following specific demonstration to get its use.
[Python]View PlainCopyprint?
- 1. View resources in the current cluster
- #下面的查询可知, there are two service in the current cluster environment
- [Email protected]:~> crs_stat-ls | grep SRV
- Ora .... O4a.srv Oracle Oinstall rwxrwxr--
- Ora .... 0g1.srv Oracle Oinstall rwxrwxr--
- #获得service的全称
- [Email protected]:~> crs_stat-p | grep SRV
- Name=ora. GOBO4. Gobo4_srv. Gobo4a.srv
- Name=ora.ora10g.hr_ora10g.ora10g1.srv
- Description=ora.ora10g.hr_ora10g.ora10g1.srv
- #下面通过crs_getperm获得资源的所有者即权限
- [Email protected]:~> crs_getperm ora.ora10g.hr_ora10g.ora10g1.srv
- Name:ora.ora10g.hr_ora10g.ora10g1.srv
- Owner:oracle:rwx,pgrp:oinstall:rwx,other::r--,
- #上面owner即为所有者, Pgrp represents the owner, and other is the other user, each followed by its corresponding permissions
- 2. Usage of crs_getperm and crs_setperm
- [Email protected]:~> crs_getperm-h
- Usage:crs_getperm resource_name [-u user|-g Group] [-Q]
- #crs_getperm用法较为简单, followed by the resource name, optional for the user or group
- [Email protected]:~> crs_setperm-h #此命令稍微较crs_getperm复杂
- Usage:crs_setperm resource_name-u aclstring [-Q]
- Crs_setperm resource_name-x aclstring [-Q]
- Crs_setperm resource_name-o user_name [-Q]
- Crs_setperm resource_name-g group_name [-Q]
- -U Update the ACL string
- -X Delete the ACL string
- -O Change the owner of the resource
- -G Change the primary group of the resource
- Aclstring is one of the following:
- User:<username>:rwx
- Group:<groupname>:r-x #当心这里的group用法, you will receive an error message if you modify permissions directly using Group
- other::r--
- 3. Demo using Crs_setperm
- [Email protected]:~> su
- Password:
- #下面分别修改资源hr_ora10g的资源所有者和所属组, change all of them to Roo permissions
- Bo2dbp:/users/oracle # crs_setperm Ora.ora10g.hr_ora10g.ora10g1.srv-o Root
- Bo2dbp:/users/oracle # crs_setperm ora.ora10g.hr_ora10g.ora10g1.srv-g Root
- #查看修改之后, the owner and genus of the resource have changed
- Bo2dbp:/users/oracle # crs_getperm Ora.ora10g.hr_ora10g.ora10g1.srv
- Name:ora.ora10g.hr_ora10g.ora10g1.srv
- Owner:root:rwx,pgrp:root:rwx,other::r--,
- #修改属组的权限, change it to read, execute
- Bo2dbp:/users/oracle # crs_setperm ora.ora10g.hr_ora10g.ora10g1.srv-u pgrp:root:r-x
- Bo2dbp:/users/oracle # crs_getperm Ora.ora10g.hr_ora10g.ora10g1.srv
- Name:ora.ora10g.hr_ora10g.ora10g1.srv
- Owner:root:rwx,pgrp:root:r-x,other::r--,
- #使用同样的方式将其修改回去.
- Bo2dbp:/users/oracle # crs_setperm Ora.ora10g.hr_ora10g.ora10g1.srv-o Oracle
- Bo2dbp:/users/oracle # crs_setperm ora.ora10g.hr_ora10g.ora10g1.srv-g oinstall
- Bo2dbp:/users/oracle # crs_setperm ora.ora10g.hr_ora10g.ora10g1.srv-u pgrp:oinstall:rwx
- Bo2dbp:/users/oracle # crs_getperm Ora.ora10g.hr_ora10g.ora10g1.srv
- Name:ora.ora10g.hr_ora10g.ora10g1.srv
- Owner:oracle:rwx,pgrp:oinstall:rwx,other::r--,
- Bo2dbp:/users/oracle # su-oracle
- #所有者的权限不允许修改
- [Email protected]:~> crs_setperm ora.ora10g.hr_ora10g.ora10g1.srv-u owner:oracle:r-x
- crs-0248:acl operation failed
- [Email protected]:~> crs_setperm ora.ora10g.hr_ora10g.ora10g1.srv-u owner:oracle:rw-
- crs-0248:acl operation failed
- [Email protected]:~> crs_setperm ora.ora10g.hr_ora10g.ora10g1.srv-u owner:oracle:-wx
- crs-0248:acl operation failed
- #组权限可以修改
- [Email protected]:~> crs_setperm ora.ora10g.hr_ora10g.ora10g1.srv-u pgrp:oinstall:r-x
- [Email protected]:~> crs_getperm ora.ora10g.hr_ora10g.ora10g1.srv
- Name:ora.ora10g.hr_ora10g.ora10g1.srv
- Owner:oracle:rwx,pgrp:oinstall:r-x,other::r--,
- #other也可以修改
- [Email protected]:~> crs_setperm ora.ora10g.hr_ora10g.ora10g1.srv-u other::rwx
- [Email protected]:~> crs_getperm ora.ora10g.hr_ora10g.ora10g1.srv
- Name:ora.ora10g.hr_ora10g.ora10g1.srv
- OWNER:ORACLE:RWX,PGRP:OINSTALL:R-X,OTHER::RWX,
- #Author: Robinson
- #Blog: http://blog.csdn.net/robinson_0612
- #根据下面的查看结果可知, changes have been made and it is recommended to change it to the original state
- [Email protected]:~> crs_stat-ls |grep SRV
- Ora .... O4a.srv Oracle Oinstall rwxrwxr--
- Ora .... 0g1.srv Oracle Oinstall rwxr-xrwx
- Ext.: http://blog.csdn.net/leshami/article/details/8219242
To modify the owner and permissions of a RAC resource by using Crs_setperm