日期:2014-05-17  浏览次数:21040 次

仅有50分求解---复制远程记录时出现ORA-28009错误.
A电脑配置为: 
SQL code
OS:Ubuntu Server 8.04.1 
IP:192.168.0.2 
Computer Name:Prod 
Oracle SSID:XE 
SYS Password: dbpw
 

B电脑配置为: 
SQL code
OS:win2k3 
IP:192.168.0.3 
Computer Name:Test 
Oracle SSID:XE 
SYS Password: dbpw
 

要求: 
SQL code
从B电脑上的Oracle Xe复制某些表的记录到A电脑的Oracle XE中.
 
----------------------------------- 

过程:

修改A电脑的tnsnames.ora文件为这样:
SQL code
XE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = Prod)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )

TXE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.3)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )

   
然后在A电脑的终端下执行:
SQL code
root@Prod:/home/user# sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jul 11 14:18:09 2008

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> conn sys@XE as sysdba
Enter password: 
Connected.
SQL> copy from sys/dbpw@TXE to sys/dbpw@XE replace AD_MENU_TRL using select * from AD_MENU_TRL;

Array fetch/bind size is 15. (arraysize is 15)
Will commit when done. (copycommit is 0)
Maximum long size is 80. (long is 80)

ERROR:
ORA-28009: connection as SYS should be as SYSDBA or SYSOPER


SQL>


经Google,发现这里有介绍解决方法:
那么如何才能做到远程SYSDBA连接呢?  
二种方法:
一种是设置默认的TNSNAMES连接,即在UNIX/LINUX下设置TWO_TASK环境变量,WINDOWS下为LOCAL变量,使它等于你要连接数据库CONNECT STRNG。
第二种方法是,配置REMOTE OS的验证,以本地DBA组的成员直接访问即可。

于是我又在终端里执行:
SQL code
root@Prod:/home/user# export TWO_TASK=XE
root@Prod:/home/user# sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jul 11 14:18:09 2008

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> conn sys as sysdba
Enter password: 
Connected.
SQL> copy from sys/dbpw@TXE to sys/dbpw@XE replace AD_MENU_TRL using select * from AD_MENU_TRL;

Array fetch/bind size is 15. (arraysize is 15)
Will commit when done. (copycommit is 0)
Maximum long size is 80. (long is 80)

ERROR:
ORA-28009: connection as SYS should be as SYSDBA or SYSOPER


SQL>


------解决方案--------------------
为什么要在系统用户sys中建表呢?
一般都是新建立个别的用户然后再建表,你这种情况很少见。

另外你查查copy 命令 用户名密码连接那块应该可以加 as sysdba之类的东西
------解决方案--------------------
犯了oracle使用的致命错误!!!!!
sys和system是用来管理数据库的,坚决不建议在sys和system用户下创建任何应用数据。

把你的任何业务数据对象都创建到自己创建的用户下面!!!!!
引用楼主 clming327 的帖子:
A电脑配置为:

SQL codeOS:Ubuntu Server 8.04.1
IP:192.168.0.2
Computer Name:Prod
Oracle SSID:XE
SYS Password: dbpw



B电脑配置为:

SQL codeOS:win2k3
IP:192.168.0.3
Computer Name:Test
Oracle SSID:XE
SYS Password: dbpw



要求:

SQL code从B电脑上的Oracle Xe复制某些表的记录到A电脑的Oracle XE中.


---------------------…