Reconfigure HAS and CSS for nonRAC ASM on 11.2

 

       This document provides a procedure to configure/reconfigure the ( High Availability Service ) HAS and CSS resource on Oracle Grid Infrastructure for nonRAC setup

 

Solution

       1 When you install grid infrastructure for single instance, at the end we run root.sh, that directs you to run the following script from root login:

<GridHome>/perl/bin/perl -I<GridHome>/perl/lib -I<GridHome>/crs/install <GridHome>/crs/install/roothas.pl

 

       This script configures the ohasd daemon ( inittab and rc.d entries ) and start the followings:

# ps -ef|grep ohas
root 17162 1 0 17:05 ? 00:00:00 /bin/sh /etc/init.d/init.ohasd run
grid 17186 1 0 17:05 ? 00:00:00 /oracle/grid/bin/ohasd.bin reboot

 

If there is a need to reconfigure HAS then, we can run the following scripts from root login:

<GridHome>/perl/bin/perl -I<GridHome>/perl/lib -I<GridHome>/crs/install <GridHome>/crs/install/roothas.pl -delete
<GridHome>/perl/bin/perl -I<GridHome>/perl/lib -I<GridHome>/crs/install <GridHome>/crs/install/roothas.pl

 

       Note that the "roothas.pl -delete" will stop the cssd and diskmon resources ( and their dependent resources like ASM, Diskgroup, RDBMS ) and then will deconfigure HAS.

2009-09-15 19:03:33: Checking for super user privileges
2009-09-15 19:03:33: User has super user privileges
2009-09-15 19:03:33: Parsing the host name
Using configuration parameter file: /oracle/grid/crs/install/crsconfig_params
CRS-2673: Attempting to stop 'ora.cssd' on 'db112'
CRS-2677: Stop of 'ora.cssd' on 'db112' succeeded
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'db112'
CRS-2673: Attempting to stop 'ora.diskmon' on 'db112'
CRS-2677: Stop of 'ora.diskmon' on 'db112' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'db112' has completed
CRS-4133: Oracle High Availability Services has been stopped.
ACFS-9200: Supported
Successfully deconfigured Oracle Restart stack

 

       If there is a malformed crs installation and CRS is not runing, one need to run rootcrs.pl and roothas.pl -deconfig with force options as follows:

<GridHome>/perl/bin/perl -I<GridHome>/perl/lib -I<GridHome>/crs/install <GridHome>/crs/install/roothas.pl -deconfig -force

<GridHome>/perl/bin/perl -I<GridHome>/perl/lib -I<GridHome>/crs/install <GridHome>/crs/install/roothas.pl -delete -force

<GridHome>/perl/bin/perl -I<GridHome>/perl/lib -I<GridHome>/crs/install <GridHome>/crs/install/roothas.pl

 

       We can also stop/start, disable_auto_start/enable the HAS we use the following commands:

# cd <Grid Home>/bin
# ./crsctl stop has
# ./crsctl start has
# ./crsctl disable has
# ./crsctl enable has

 

       Here also the ora.cssd and ora.diskmon dependency on HAS is maintained. You can also use -d option with the perl script run, in case you wish to debug the script ( perl expertise is needed ).

 

 

2 Unlike 10.2 / 11.1, CSS and Diskmon processes are resources in the OCR now.

$ crsctl status resource -t
--------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------
Cluster Resources
------------------
ora.cssd 1 ONLINE ONLINE db112
ora.diskmon 1 ONLINE ONLINE db112

 

 

Daemons no more run from ../init.d scripts:

grid 26182 1 0 20:11 ? 00:00:00 /oracle/grid/bin/diskmon.bin -d -f
grid 26091 1 0 20:09 ? 00:00:00 /oracle/grid/bin/cssdagent
grid 26126 1 0 20:09 ? 00:00:00 /oracle/grid/bin/ocssd.bin

 

The following commands should NOT be used to remove/add the CSS resource from OCR

#./crsctl delete resource ora.cssd
#./crsctl add resource ora.cssd -type

 

Instead use the delete and add commands of HAS to delete/add CSS/Diskmon.

 

 

 

 

 

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>好的,我现在需要解决用户提到的Python中出现的“TTYOutStream对象没有reconfigure属性”的错误。首先,我得弄清楚这个错误发生的背景和原因。 用户之前的问题是关于如何下载sys库,而我的回答解释了sys是Python标准库的一部分,不需要安装。现在用户的新问题涉及到TTYOutStream和reconfigure属性,这可能与终端输出流或某些库的配置有关。我需要结合之前的对话来确保回答的一致性,同时提供有效的解决方案。 首先,我应该回忆一下常见的Python库中哪些会涉及TTYOutStream。Jupyter Notebook或IPython组件可能会使用这样的对象,因为它们处理终端输出。例如,IPython.utils.io中的TTYOutStream可能在某些版本中存在变化。如果用户在使用Jupyter或IPython时遇到了这个错误,可能是因为代码中调用了reconfigure方法,但该属性在当前的库版本中不存在。 接下来,我需要检查可能的解决方案。用户提到的错误是属性不存在,常见原因包括版本不兼容、代码依赖于过时的方法,或者库的API发生了变化。例如,在较新版本的IPython中,某些方法可能已被弃用或移除。如果用户从旧版本升级后遇到此错误,可能需要调整代码以适应新的API。 另外,参考用户提供的引用内容,虽然引用了关于matplotlib安装问题和数据库连接的内容,但这些可能与当前问题无关。但用户提到需要参考之前的对话,所以我要确保解决方案与之前的sys库问题没有冲突,同时保持回答的准确性。 可能的解决步骤包括: 1. 检查使用的IPython或Jupyter版本,确认reconfigure方法是否存在。 2. 查看代码中调用reconfigure的地方,是否有替代方法或属性。 3. 更新或降级相关库的版本以解决兼容性问题。 4. 修改代码以避免使用已弃用的方法。 例如,如果用户在使用IPython的某些输出配置时调用了reconfigure,可能需要查找官方文档或变更日志,看看该方法是否被替换。例如,可能替换为其他配置方式,或者需要调整参数传递的方法。 同时,考虑用户可能的环境问题,比如虚拟环境中的库版本不一致,或者多个库之间的依赖冲突。建议用户检查环境中的库版本,并尝试在干净的环境中复现问题,以排除其他干扰因素。 总结来说,解决此错误的关键在于确定TTYOutStream的来源,检查相关库的版本和文档,调整代码以适应API的变化,并确保环境中的依赖项兼容。</think>### 解决方案:Python中`TTYOutStream`对象缺少`reconfigure`属性的错误分析 该错误通常与**IPython/Jupyter**环境中的输出流配置或依赖库版本不兼容相关。以下是具体原因及解决方法: --- #### **1. 依赖库版本冲突** `TTYOutStream`是IPython库中用于管理终端输出的对象。在较新版本(如IPython ≥8.0)中,部分API接口(如`reconfigure`)可能已被移除或重构[^1]。若代码中调用了此方法,则会触发属性缺失错误。 **解决方法:** - **降级IPython版本**: 回退到兼容旧API的版本: ```bash pip install "ipython<8.0" ``` - **检查代码兼容性**: 替换或删除对`reconfigure`的调用。例如,旧代码中可能通过以下方式配置输出编码: ```python from IPython.utils.io import TTYOutStream sys.stdout = TTYOutStream(sys.stdout) sys.stdout.reconfigure(encoding='utf-8') # 已失效的方法 ``` 可改用标准库的配置方式: ```python import sys sys.stdout.reconfigure(encoding='utf-8') # 直接使用Python内置的reconfigure ``` --- #### **2. Jupyter环境中的输出流封装问题** 在Jupyter Notebook中,系统可能对标准输出(`sys.stdout`)进行了二次封装,导致直接操作`TTYOutStream`时出现属性缺失[^2]。 **解决方法:** - **绕过封装层**: 直接使用原生`sys.stdout`而非IPython的封装对象: ```python import sys sys.stdout.reconfigure(encoding='utf-8') # 直接操作原生输出流 ``` - **检查环境类型**: 添加条件判断以区分运行环境: ```python from IPython import get_ipython if get_ipython() is None: # 在普通Python环境中操作 sys.stdout.reconfigure(encoding='utf-8') else: # 在Jupyter环境中使用替代方法 sys.stdout.encoding = 'utf-8' ``` --- #### **3. 验证依赖关系** 确保所有相关库的版本兼容。例如,`ipython`、`jupyter`、`notebook`等可能存在版本依赖冲突。 **操作步骤:** 1. 生成依赖清单: ```bash pip list | grep -E "ipython|jupyter|notebook|traitlets" ``` 2. 更新关键库至兼容版本: ```bash pip install --upgrade jupyter ipython notebook traitlets ``` --- ### 示例代码修复 **错误代码片段:** ```python from IPython.utils.io import TTYOutStream sys.stdout = TTYOutStream(sys.stdout) sys.stdout.reconfigure(encoding='utf-8') # 报错位置 ``` **修正后代码:** ```python import sys # 直接使用Python原生方法配置输出流 if hasattr(sys.stdout, 'reconfigure'): sys.stdout.reconfigure(encoding='utf-8') else: sys.stdout.encoding = 'utf-8' # 兼容无reconfigure方法的环境 ``` --- ### 相关问题 1. **如何检查当前Python环境中已安装库的版本?** 使用`pip list`或`pip show package_name`命令[^3]。 2. **Jupyter Notebook中标准输入输出与原生Python有何区别?** Jupyter会封装`sys.stdout`以实现富文本输出,可能导致部分方法不可用[^2]。 3. **Python中如何动态修改输出流的编码方式?** 优先使用`sys.stdout.reconfigure()`(Python ≥3.7),或通过`io.TextIOWrapper`重定向[^4]。 --- 通过以上方法,可针对性解决`TTYOutStream`的`reconfigure`属性缺失问题,同时确保代码的跨版本兼容性。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值