创建表空间GDZC
创建用户GDZCUSER 建议密码也是GDZCUSER,并选择表空间默认值“GDZC”,并为其分配角色。请根据上面的描述写出相应的SQL语句吧,我写过一段,好像也成功,但最后总有点小问题,搞不明白错在哪里,我的语句如下://创建数据表空间
create tablespace GDZC
logging
datafile 'D:\oracle\product\10.1.0\oradata\GDZC\GDZC.dbf'
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;
//创建用户并指定表空间
create user GDZCUSER identified by GDZCUSER
default tablespace GDZC
temporary tablespace GDZC_temp;
//给用户授予权限
grant connect,resource to GDZCUSER;从新用GDZCUSER登陆,看看方案中是否有GDZCUSER存在。这句话中说的用GDZCUSER登录,是登录到哪里,SQLPLUS还是什么?,看方案中是否有GDZCUSER存在,方案指什么?
另外还有一个问题就是,我在初期建好数据库后,连接一个.NET的程序,程序运行后会报错,错误提示如下:
请高手帮忙看看是什么原因造成这种问题,并且我想问一下为什么我用GDZCUSER登录SQLPLUS以后无法使用IMP功能,提示只有DBA人员才可以使用这个功能?

解决方案 »

  1.   

    MD,错误提示的图发不上来了,我手抄了一下:unhandled exception has occurred in your application.if you click continue,the application will ignore this error and attempt to continue.if you click quit,the application
    will close immediately.
    ORA-12154:TNS:could not resolve the connect identifier specified
      

  2.   

    问题在那几个.ora文件中吧,你用建数据库时生成的那些默认用户登录有没有这些问题?
      

  3.   

    1、无论是sqlplus还是plsql,conn GDZCUSER/GDZCUSER 能连接上,证明当前用户正常。
    2、ORA-12154:TNS:could not resolve the connect identifier specified
       从错误上看,是本地服务名配置的错误。看看本地的tnsnames.ora文件是否正确。
    3、imp并不是sqlplus中的命令,他是个外部命令。在cmd下直接执行。
       GDZCUSER 默认能导出本用户的数据,除非授予他dba权限或exp_full_database权限,否则,不能导出其他的用户的数据。
      

  4.   

    1、无论是sqlplus还是plsql,conn GDZCUSER/GDZCUSER 能连接上,证明当前用户正常。
    2、ORA-12154:TNS:could not resolve the connect identifier specified
       从错误上看,是本地服务名配置的错误。看看本地的tnsnames.ora文件是否正确。
    3、imp并不是sqlplus中的命令,他是个外部命令。在cmd下直接执行。
       GDZCUSER 默认能导出本用户的数据,除非授予他dba权限或exp_full_database权限,否则,不能导出其他的用户的数据。
      

  5.   

    # tnsnames.ora Network Configuration File: D:\oracle\product\10.1.0\Db_1\network\admin\tnsnames.ora
    # Generated by Oracle configuration tools.ORCL =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = pd-46d69cbfd588)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = orcl)
        )
      )EXTPROC_CONNECTION_DATA =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
        )
        (CONNECT_DATA =
          (SID = PLSExtProc)
          (PRESENTATION = RO)
        )
      )
      

  6.   


    //创建数据表空间
    create tablespace GDZC
    logging
    datafile 'D:\oracle\product\10.1.0\oradata\GDZC\GDZC.dbf'
    size 32m
    autoextend on
    next 32m maxsize 2048m
    extent management local;
    //创建用户并指定表空间
    create user GDZCUSER identified by GDZCUSER
    default tablespace GDZC
    temporary tablespace GDZC_temp;
    //给用户授予权限
    grant connect,resource to GDZCUSER;为什么我用上面的这段语句建立表空间,用户,然后授权,但是以GDZCUSER这个用户进入SQLPLUS后,却无法查询,或是新建表空间,SELECT 查询时会提示表空间未建立,但实际上是建立了啊,并且以SYSTEM用户进的时侯可以查询
      

  7.   

    你把所有的权限都授予GDZCUSER看看有什么不同的结果?
      

  8.   

    1.方案就是用户;
    2.你先连接到sysdba再导入导出
    conn / as sysdba;
      

  9.   

    GDZCUSER用户通过什么语句查询或创建的的。
    GDZCUSER 用户是否有创建表空间的权限呢 ?
      

  10.   

    这种情况的出现,我建议你去查一下,你建立的表空间是否真的建立成功了.如果建立成功的话,再看一下你的表空间的status!
      

  11.   

    我是以SYSTEM建立的表空间,用户,然后给用户授的权,但现在看来,SYSTEM用户可以查看到新建的表空间的内容,并且我新插入列值都可以查到,但以新建用户进入,select * from tbl_callnbr;则会提示:
    RROR at line 1:
    RA-00942: table or view does not exist看样式,新建表空间的权限并没有授给用户,不知为什么,我帖出的语句有问题吗?
      

  12.   

    按照你的SQL语句,你还需要创建表空间GDZC_TEMP
    方案就是用户
    只要你能用这个用户在登录就行
    至于.net不能连接应该是你的tnsnames没有配置好
      

  13.   

    现在的报错提示是:ORA-12154: TNS: 无法解析指定的连接标识符
    具体内容如下:See the end of this message for details on invoking 
    just-in-time (JIT) debugging instead of this dialog box.************** Exception Text **************
    System.Data.OracleClient.OracleException: ORA-12154: TNS: 无法解析指定的连接标识符   at System.Data.OracleClient.OracleException.Check(OciErrorHandle errorHandle, Int32 rc)
       at System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName)
       at System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions)
       at System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
       at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.OracleClient.OracleConnection.Open()
       at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
       at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
       at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
       at SmsForInsurance.DataAccess.GetCallingNumber()
       at SmsForInsurance.frmMain.timerConnect_Tick(Object sender, EventArgs e)
       at System.Windows.Forms.Timer.OnTick(EventArgs e)
       at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)我的连接信息是:
    <root>
      <caption>中国网通短信发送程序</caption>
      <connectstring>Data Source=Oracle;User Id=system;Password=admin;</connectstring>
      <smsconnecttimeout>6</smsconnecttimeout>
    </root>
      

  14.   

    用IMP一般是不能更改表空间的   
      可以用如下方式,更改存放表的表空间。   
      ALTER   TABLE   TABLE_NAME   MOVE   TABLESPACE   NEW_TABLESPACE_NAME;