当然可以,只要连接提DBA用户,就有权限执行. under VB(ADO2.5) =============================================================== Option Explicit Private Sub Command1_Click() Dim conn As ADODB.Connection Dim cmd As ADODB.Command Dim rs As ADODB.Recordset
Set conn = New ADODB.Connection conn.CursorLocation = adUseClient conn.Open "Provider=MSDAORA.1;" & _ "Password=qsun;User ID=qsun;" & _ "Data Source=manu;"
Set cmd = New ADODB.Command cmd.ActiveConnection = conn cmd.CommandType = adCmdText cmd.CommandText = " ......" --省略号就要楼主自已考虑 ...
如果是普通用户,这样就可以了 create user test identified by test; grant create session to test; grant connect to test; grant create tablespace to test;
建个用户,角色里面只要把DBA选上就可以了啊。
Dim strConn As String
Dim i As Long
If Not Conn Is Nothing Then Set Conn = Nothing
Set Conn = New ADODB.Connection
strConn = ""
strConn = strConn & "Provider=OraOLEDB.Oracle;"
strConn = strConn & "Data Source=" & ServerName & ";"
strConn = strConn & "User ID=" & UserName & ";"
strConn = strConn & "PassWord=" & PassWord & ";"
Conn.ConnectionString = strConn
Conn.CommandTimeout = 60
Conn.CursorLocation = adUseClient
Conn.Open
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
下面这一句报错,因为没有 SYSDBA的权限,我要怎么在建立连接的时候加上SYSDBA的连接身份呢??
Conn.Execute "begin system.createtablespace('ZZZ'); end;", , adCmdText
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Debug.Print "Connection Success!!!" & " (Conn_Oracle)"
Conn_Oracle = True
Exit Function
End Function
我发的帖子不过是flyingZFX(★我飞★我飞★我飞呀飞★) 问的,谢谢大家回答啊
不过还是回答问题吧,谢谢
begin
Close;
SQL.Add('create tablespace gene datafile ''d:/gene.dbf'' size 5m autoextend on');
ExecSQL;
end;
Application.MessageBox('表空间gene已经被创建','创建表空间提示',MB_OK+MB_DEFBUTTON1+MB_Iconexclamation+MB_applmodal);
end;
SYSDBA并不是什么权限,是连接模式。。
你的用户至少要有create tablespace系统权限的。。
我用的是system用户,当然有建表空间的权限。。
给你看我的连接字符串。。Provider=MSDAORA.1;Password=genomics;User ID=system;Data Source=atgc;Persist Security Info=True
under VB(ADO2.5)
===============================================================
Option Explicit
Private Sub Command1_Click()
Dim conn As ADODB.Connection
Dim cmd As ADODB.Command
Dim rs As ADODB.Recordset
Set conn = New ADODB.Connection
conn.CursorLocation = adUseClient
conn.Open "Provider=MSDAORA.1;" & _
"Password=qsun;User ID=qsun;" & _
"Data Source=manu;"
Set cmd = New ADODB.Command
cmd.ActiveConnection = conn
cmd.CommandType = adCmdText
cmd.CommandText = " ......" --省略号就要楼主自已考虑
...
create user test identified by test;
grant create session to test;
grant connect to test;
grant create tablespace to test;
我现在又遇到了一个问题,,就是我已经使用
Conn.Execute "CREATE TABLESPACE ""FLYINGZFX"" DATAFILE 'd:\flyingzfx.dbf' SIZE 5m autoextend on", , adCmdText这条语句成功的建立了表空间,
之后,我在OEM中把新建立的表空间删除了,我再去执行上面的语句,系统就报错了
告诉我“'d:\flyingzfx.dbf' ”已经存在了。请问,怎么样解决,??
当你执行了drop tablespace是,oracle并不会自动删除和这个tablespac对应的数据文件
所以删除了表空间后,还要执行操作系统命令删除数据文件 del flyingzfx.dbf
要不然,你下次建表空间的时候指定了和这个同名的数据文件,就报错了。。
grant connect to test;
grant create tablespace to test;
C:\>del D:\ORACLE\ORADATA\TEST\.....DBF
C:\>del D:\ORACLE\ORADATA\TEST\.....DBF
你的这两句话什么意思???是两句话,都必须用,,还是任何一句都行。