Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Shell string interception-get the oracle group name

2025-04-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Business background, when executing oracle files, you need to authorize the corresponding files. On the one hand, we use chown-Roracle:oraclegroup xxx. Different servers have different oraclegroup names. How to get them?

Method: first of all, we can get the oraclegroups with the command groups oracle, in the following format:

Oracle: oinstall dba

How do I get the group name (oinstall)?

Provide the following method 1: use awk to get the third string

Oraclegroup= `groups oracle | grep-v grep | awk' {print $3}'`

If ["$oraclegroup" = ""]; then

Echo "There is no Oracle group"

Exit 1

Else

Chown-R oracle:$oraclegroup $directory

Fi

Method 2: use the for loop to get the third element

Groups= `groups oracle`

Oraclegroup= ""

ITunes 0

For element in $groups

Do

Let iTunes +

If `I-eq 3 `; then

Export oraclegroup=$element

Echo$element

Break

Fi

Done

If ["$oraclegroup" = ""]; then

Echo "There is no Oracle group"

Exit

Else

Chown oracle:$oraclegroup$targetfolder/Init_Upgrademanagement.sql

Fi

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report