本案例是使用python创建oracle账号,使用cx_Oracle库
1.安装cx_Oracle库
pip install cx_Oracle
2.建立oracle连接
testdb=cx_Oracle.connect('test/TEST@192.168.1.2/test')
cursor = testdb.cursor()
3.创建账号
cursor.execute('create user %s identified by TEST default tablespace %s' %(username,tablespace))
cursor.execute('grant connect ,dba to %s'%username)
cursor.close()