How To Automate ASM Startup and Shutdown on AIX 5L [ID 580133.1]

 

       Oracle recommends that you configure your system to automatically to start Oracle ASM instances and Database Instances when the system starts up, and to automatically shut them down when the system shuts down. Automating ASM/Database startup and shutdown guards against incorrect database shutdown.

       The present document described how to Automate ASM Startup and Shutdown on AIX 5L.

 

 

步骤如下:

The first step is to create the dbora shell script and place it in the /etc/init.d directory:

1)  Log in as the root user.

2)  Edit the oratab file:

# vi /etc/oratab

3)  Update the oratab with the next entry:

+ASM:<ASM Oracle Home>:Y

Example:

+ASM:/u02/app/oracle/11g:Y

 

4)  Change to the /etc directory for AIX:

# cd /etc

 

5)  Create a file called dbora:

# touch /etc/dbora

 

6)  Copy the following lines into this file:

# Note: Change the value of the ORACLE_HOME environment variable to your ASM 
# Oracle home directory for the installation. Change the value of the ORACLE 
# environment variable to the user name of the owner of the database installed in the 
# Oracle home directory (typically, oracle).


#! /bin/sh  -x
#
# Change the value of ORACLE_HOME to specify the correct Oracle home
# directory for your installation.

ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
#
# Change the value of ORACLE to the login name of the
# oracle owner at your site.
#
ORACLE=oracle

PATH=${PATH}:$ORACLE_HOME/bin
HOST=`hostname`
PLATFORM=`uname`
export ORACLE_HOME PATH
#
if [ ! "$2" = "ORA_DB" ] ; then
   if [ "$PLATFORM" = "HP-UX" ] ; then
      remsh $HOST -l $ORACLE -n "$0 $1 ORA_DB"
      exit
   else
      rsh $HOST -l $ORACLE  $0 $1 ORA_DB
      exit
   fi
fi
#
case $1 in
'start')
        $ORACLE_HOME/bin/dbstart $ORACLE_HOME &
        ;;
'stop')
        $ORACLE_HOME/bin/dbshut $ORACLE_HOME &
        ;;
*)
        echo "usage: $0 {start|stop}"
        exit
        ;;
esac
#
exit

 

7)  Change the group of the dbora file to the OSDBA group (typically dba), and set the permissions to 750:

# chgrp dba dbora
# chmod 750 dbora

 

8)  For ASM instances, the /etc/dbora script cannot be used inside an rc*.d directory and it needs to be invoked from rc.local only. Otherwise, the CSS service may not be available yet, and this script will block init from completing the boot cycle. Therefore please perform the next steps to create the /etc/rc.local file:

# mkitab -i rcnfs "rclocal:2:wait:/etc/rc.local >/dev/console 2>&1"
# touch /etc/rc.local
# chmod 700 /etc/rc.local

 

9)  Then update the /etc/rc.local file with the next line:

/etc/dbora &

 

 

 

 

From Oracle

-------------------------------------------------------------------------------------------------------

QQ: 492913789
Email: ahdba@qq.com
Blog: http://www.cndba.cn/dave

DBA1 群:62697716();   DBA2 群:62697977()   DBA3 群:62697850()  

DBA 超级群:63306533();  DBA4 群: 83829929  DBA5群: 142216823   

聊天 群:40132017   聊天2群:69087192

--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请

<think> 我们面对的错误信息是: Unable to start activity ComponentInfo{com.automate/com.automate.activity.app.ActivitySetting}: android.content.res.Resources$NotFoundException: String resource ID #0x0 这个错误通常发生在尝试使用一个资源ID(这里是0x0,即0)去获取字符串资源时,而该资源ID没有对应的字符串资源。 根据引用[1]到[5]提供的线索,我们可以分析以下几种可能的原因及解决方案: 1. **资源ID为0**:通常是因为我们在某个需要字符串资源的地方传入了一个整型值(比如0),而系统尝试将其作为字符串资源ID去查找,但没有找到。例如,在`setText()`方法中,如果我们传入一个整型值,系统会将其视为资源ID,如果该ID不存在就会抛出此异常。 2. **布局文件或代码中的错误**:可能是在Activity的布局文件中引用了不存在的字符串资源,或者在代码中错误地使用了整型值作为资源ID。 3. **Activity注册问题**:虽然错误信息不是直接提示ComponentInfo找不到,但我们也要确保Activity在AndroidManifest.xml中正确注册(引用[1]和[5]都提到了Activity注册问题)。 4. **主题问题**:引用[4]提到,Activity的主题设置不正确也可能导致类似问题,但这里错误信息指向字符串资源,所以可能性较小。 5. **XML布局文件中的错误**:引用[3]提到,XML文件中标签使用错误可能导致类似问题,但错误信息不同。 根据错误信息,我们重点关注资源ID为0的问题。 ### 解决步骤 1. **检查代码中所有使用`setText()`的地方**:在`ActivitySetting`这个Activity中,检查是否有调用`TextView.setText(int resid)`方法时传入了一个整型值0。例如: ```java textView.setText(0); // 错误,因为0不是有效的字符串资源ID ``` 如果确实有这样的代码,应该传入一个有效的字符串资源ID,或者传入一个字符串(使用`setText(String)`方法)。 2. **检查其他需要资源ID的方法**:除了`setText`,还有其他方法也可能使用资源ID,比如`setTitle`等。同样检查是否传入了0。 3. **检查布局文件**:检查`ActivitySetting`对应的布局文件(如`activity_setting.xml`)中是否有任何使用字符串资源的地方引用了不存在的资源。特别是检查`android:text`属性,是否设置了一个不存在的字符串资源。 4. **检查AndroidManifest.xml**:确认`ActivitySetting`是否已正确注册,并且包名路径正确(引用[1])。 5. **检查传入的Intent数据**:如果这个Activity在启动时接收了Intent数据,并且在设置文本时使用了这个数据,那么需要检查是否从Intent中获取了一个整型值(比如0)并直接设置给了TextView。 ### 示例代码分析 假设在`ActivitySetting`中有如下代码: ```java public class ActivitySetting extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_setting); TextView textView = findViewById(R.id.text_view); int value = getIntent().getIntExtra("some_key", 0); // 错误:将整型值直接设置给setText(int)方法 textView.setText(value); } } ``` 上面的代码中,如果`value`是0,那么就会导致`setText(0)`,而0不是有效的资源ID,因此抛出`Resources$NotFoundException`。 **修正方法**:将整型值转换为字符串。 ```java textView.setText(String.valueOf(value)); ``` 或者,如果你确实想显示一个字符串资源,那么应该传入一个有效的资源ID(非0)。 ### 总结步骤 1. 在`ActivitySetting`中查找所有调用`setText`的地方,确保传入的不是0(除非0是有效的资源ID,但0通常不是)。 2. 同样检查其他类似方法。 3. 检查布局文件中引用的字符串资源是否存在。 4. 确保Activity在AndroidManifest.xml中正确注册。 如果按照以上步骤检查,应该能解决这个错误。 §§相关问题§§ 1. Android中常见的资源找不到异常有哪些? 2. 如何正确使用setText方法设置整型数值? 3. AndroidManifest.xml中注册Activity的注意事项有哪些? </think> ### 解决 "Unable to start activity ComponentInfo...Resources$NotFoundException: String resource ID #0x0" 错误 该错误通常发生在尝试使用无效的资源ID(特别是整型值0)设置文本内容时。以下是具体原因和解决方法: #### 错误原因分析 1. **资源ID无效**:`String resource ID #0x0` 表示系统尝试访问一个不存在的字符串资源(资源ID为0) 2. **整型值误用**:最常见场景是在 `TextView.setText()` 方法中传入整型值(如0),而Android会将其误判为资源ID 3. **XML引用错误**:布局文件中引用了不存在的字符串资源(但本错误明确指向ID#0x0,更可能是代码问题) #### 解决方案 1. **检查所有 `setText()` 调用** 找到 `ActivitySetting` 中所有设置文本的代码,特别是: ```java // 错误示例:传入整型值(如0) textView.setText(0); // 导致Resources$NotFoundException // 正确做法1:转换为字符串 textView.setText(String.valueOf(0)); // 正确做法2:使用实际字符串资源 textView.setText(R.string.valid_resource); ``` 2. **检查数据绑定代码** 若使用Data Binding,确保绑定的整型数据已转换为字符串: ```xml <!-- 错误示例 --> <TextView android:text="@{user.age}"/> <!-- 正确做法 --> <TextView android:text="@{String.valueOf(user.age)}"/> ``` 3. **验证资源文件** 检查 `res/values/strings.xml` 中是否存在被引用的资源: ```xml <!-- 确保资源ID有效且存在 --> <string name="valid_resource">实际文本</string> ``` 4. **检查 AndroidManifest.xml 注册**(参考引用[1][5]) 确认 `ActivitySetting` 已正确声明: ```xml <activity android:name=".activity.app.ActivitySetting" android:theme="@style/AppTheme"> <!-- 检查主题引用,参考引用[4] --> </activity> ``` #### 调试技巧 1. **日志定位**:在 `ActivitySetting` 的 `onCreate()` 添加日志,确认崩溃位置 ```java protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("DEBUG", "Activity created"); // 添加此日志 setContentView(R.layout.activity_setting); // ...其他代码 } ``` 2. **检查堆栈跟踪**:查看 `Resources$NotFoundException` 上方的 "Caused by" 定位具体代码行 3. **全局搜索**:在项目中搜索 `setText(` 找出所有可能传入整型值的位置 > **经验提示**:该错误90%以上发生在 `setText()` 中直接使用整型变量时。例如显示数据库ID、计数器等数值时未转换类型[^1][^2]。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值