cx_Oracle:ORA-00922:更改会话命令的选项丢失或无效 [英] cx_Oracle: ORA-00922: missing or invalid option for alter session command

查看:68
本文介绍了cx_Oracle:ORA-00922:更改会话命令的选项丢失或无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试使用cx_Oracle从我的python程序中运行以下命令:

I am currently trying to run the following command from within my python program using cx_Oracle:

更改会话集"_use_nosegment_indexes" = true;

我正在尝试为一个大学项目编写一个程序,该程序可用于索引调整,并且需要能够在程序内部运行解释计划,该计划可以很好地考虑虚拟索引.根据我的理解,需要设置以上内容以使此操作发生,但是我在python中收到以下错误:

I am trying to write a program for a university project that can be used for index tuning and need to be able to run explain plans from within the program (which is working fine) that take into account virtual indexes. From my understanding, the above needs to be set in order for this to happen but i get the following error in python:

cx_Oracle.DatabaseError:ORA-00922:缺少或无效的选项

所有这些操作都是通过与运行Oracle的远程服务器的连接完成的.我是在做错什么,还是cx_Oracle不支持的事情,在这种情况下,我可以在可以执行此操作的地方使用另一个软件包.如果没有,我是否可以尝试在另一个DBMS上尝试在哪里可以从python程序中运行虚拟索引的解释计划.

This is all being done over a connection to the remote server that Oracle is running on. Am i doing something wrong or is this something that is not supported by cx_Oracle, in which case is there another package i could use where i can do this. If not, is there another DBMS that i could try this on where explain plans for virtual indexes can be run from within a python program.

谢谢

推荐答案

最后找到单引号和双引号的正确组合.最后,有效的代码是:

Finally found the right combination of single quotes and double quotes. In the end the code that worked was:

query = "alter session set \"_use_nosegment_indexes\" = true"
dbcursor.execute(query)

这篇关于cx_Oracle:ORA-00922:更改会话命令的选项丢失或无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆