oracle要直接对文件进行读写必须先创建一个DIRECTORY. 语法如下: CREATE DIRECTORY UTL_FILE_DIR AS '/home/oracle/oradir'; 可以通过如下SQL查看已经创建的DIRECTORY select * from all_directories; 创建后如果要对该路径下文件进行读写,必须授权. 代码如下: GRANT READ,WRITE ON DIRECTORY UTL_FILE_DIR TO scott; 查询DIRECTORY的读写
整体思路:通过使用外部表将用户名导入Oracle的表中,然后通过PL/SQL遍历数据表,批量创建用户. 具体步骤如下: 1.在安装数据库的服务器的C盘根目录创建一个User List.txt文件,内容如下: 2.以sys用户登录数据库,创建directory对象. create directory test_d as 'c:\'; 3.给scott用户赋予读写directory对象的权限: grant read, write on directory test_d to scott; 4.切换到
1.创建用户: create user toptea2 identified by "用户名" 2.给用户授权 grant create session to 用户名; grant create table to 用户名; grant create tablespace to 用户名; grant create view to 用户名; 3.查询表空间大小 select file_name,bytes/1024/1024||'M' "size" from dba_d
在平常备库和数据库迁移的时候,当遇到大的数据库的时候在用exp的时候往往是需要好几个小时,耗费大量时间.oracle10g以后可以用expdp来导出数据库花费的时间要远小于exp花费的时间,而且文件也要小很多. 1.使用expdp要先在数据库中创建directory,并给相应的用户read,write权限. SQL>create dexp和empdp的区别irectory dmpdir as '/u01/dmdir'; SQL>grant read,write on direct
oracle导出excel(非csv)的方法有两种,1.使用sqlplus spool,2.使用包体 现将网上相关代码整理后贴出以备不时之需: 使用sqlplus: 使用sqlplus需要两个文件:sql脚本文件和格式设置文件. 去除冗余信息,main.sql --main.sql 注意,需要在sqlplus下运行 非plsql命令行下 set markup html on entmap ON spool on preformat off spool test_tables.xls @get_
1.从数据查出数据扔进table中: private DataTable getTable() { var dbHelper = applyBLL.CreateDataBase("VISAdoDb"); StringBuilder SB = new StringBuilder(); SB.AppendFormat("Select ApplyForID,Applicants,CardNo from VIS_ApplyFor where iState = 0 and (Apply