sqlplus

Spooling multiple files

馋奶兔 提交于 2021-02-19 06:58:22
问题 I have a report that I need to export to a csv file for n number of vendors. i have a feeling that I will need to run this more than once so I would like to automate it as much as possible. I wrote the sql plus needed to for one vendor, I'm wonder how can script it to run for each vendor. I have the vendor list stored in the table in the db, but knowing I can't put spool in an pl/sql block, I'm wonder how I can loop through each vendor to create their file. 回答1: I've done similar things by

Oracle 11g - run windows batch file to run multiple sql files in sqlplus

陌路散爱 提交于 2021-02-19 04:02:37
问题 I would like to use a single batch file to execute multiple sql in a sequence.. IE: sql2 script calls a table created by sql1 script.. etc.. here is the batch code I have so far.. it works to run a single sql file but I need it to run the first one and then then next.. thanks in advance. @ECHO OFF echo. echo. SET /P uname=Username: echo. echo. SET /P pass=Password: echo. echo. SET /P mydatabase=Database: echo. echo. set oracle_sid=ins sqlplus -s %uname%/%pass%@%mydatabase% @J:/A/scripts/

Make SQL*Plus script quit

跟風遠走 提交于 2021-02-15 07:08:14
问题 I have a few SQL*Plus scripts in a directory that I would like to run automatically using powershell. I can read the directory and but when I tried to execute the script, the scripts terminated but did not quit powershell and go to the next one. How do I make powershell quit SQL*Plus and go to the next script automatically without me modifying the scripts by explicitly adding a quit at the end of each script? Below is the illustrated powershell script in its simplest form $Filename=Get

Ogg

断了今生、忘了曾经 提交于 2021-02-13 19:04:46
说明:这篇文章将介绍如何配置oracle到mysql的ogg同步 源端:ip-192.168.56.11 数据库类型-oracle 11.2.0.4 目标端:ip-192.168.56.71 数据库类型-mysql 5.7.25 1. 解压并准备目录 (源端) su - oracle mkdir -p /home/oracle/ogg1/ tar -xvf fbo_ggs_Linux_x64_ora11g_64bit.tar -C /home/oracle/ogg1 (目标端) su - mysql mkdir -p /home/mysql/ogg2/ tar -xvf ggs_Linux_x64_MySQL_64bit.tar -C /home/mysql/ogg2 创建socket软链接,mysql ogg默认使用/tmp/mysql.sock 查看mysql socket的位置 (root@localhost)[(none)]> show variables like 'socket'; +---------------+-----------------------------+ | Variable_name | Value | +---------------+-----------------------------+ | socket | /opt/mydata

win中Oracle简易客户端和plsql的配置

ⅰ亾dé卋堺 提交于 2021-02-11 07:07:15
连接数据库有2种方式:在本机安装Oracle数据库或者是安装一个oracle简易客户端 当然,简易客户端跟oracle数据库比较少了一些功能 连接方式: 1)简易连接 sqlplus scott/tiger@10.0.0.10:1521/study 注意最后的study是服务名,别搞错了 这种ora-12514的报错就是前面的账户密码地址端口一般都正确而服务名写错了 2)本地命名 tnsnames.ora配置好字符串 然后连接 下面介绍一下安装oracle简易客户端和plsql的配置: 1)下载一个oracle简易客户端和plsql(有绿色解压版) 2)将下载的客户端的简易包,解压缩到磁盘上的某一目录,例如:F:\instantclient_12_1 3)设置系统的环境变量 点击计算机->系统属性-〉高级系统设置-〉高级-〉环境变量-〉系统变量 1.将路径 F:\instantclient_12_1;添加到环境变量path中 2.设置ORACLE_HOME : F:\instantclient_12_1 3.设置NLS_LANG : SIMPLIFIED CHINESE_CHINA.ZHS16GBK american_america.AL32UTF8 4.设置TNS_ADMIN : F:\instantclient_12_1 4)在目录 F:\instantclient_12_1

How to create incrementing columns?

寵の児 提交于 2021-02-11 06:42:12
问题 I have table with these column names. Province/State Country/Region Lat Long 1/22/20 1/23/20 1/24/20 1/25/20 ... ... 3/21/20 I know to create first 4 columns but I don't know how create date column and increment it. How can I implement such number of columns at once? Thank you! Infected Dead Recovered Object relational data model created by me Question -: Submit working Oracle script for your database schema. 回答1: Don't try to create a column-per-day; just create a table with columns for

(转) Oracle性能优化-读懂执行计划

 ̄綄美尐妖づ 提交于 2021-02-10 18:48:29
Oracle的执行计划 得到执行计划的方式 Autotrace例子 使用Explain explain plan set STATEMENT_ID='testplan' for select * from dual; select lpad(' ',5*(level-1))||operation operation, options, object_name, cost,position from plan_table start with id=0 and STATEMENT_ID='testplan' connect by prior id=parent_id ; 怎样看执行计划 看懂执行计划前先需要了解的一些知识 伪列-ROWID rowid是一个伪列,既然是伪列,那么这个列就不是用户定义,而是系统自己给加上的。对每个表都有一个rowid的伪列,但是表中并不物理存储ROWID列的值。不过你可以像使用其它列那样使用它,但是不能删除改列,也不能对该列的值进行修改、插入。一旦一行数据插入数据库,则rowid在该行的生命周期内是唯一的,即即使该行产生行迁移,行的rowid也不会改变。 Recursive SQL 有时为了执行用户发出的一个sql语句,Oracle必须执行一些额外的语句,我们将这些额外的语句称之为‘recursive calls’或‘recursive SQL

Is it possible to run a sqlplus file inside a stored procedure?

隐身守侯 提交于 2021-02-10 15:56:01
问题 Hi is it possible to run and execute a sqlplus file from inside a stored procedure ? I have tried the following so far: CREATE OR REPLACE PROCEDURE SCRIPTRUN ( p_orgid IN VARCHAR2, p_axtype IN VARCHAR2, P_option IN VARCHAR2 ) AS runn VARCHAR2(200) := '@C:\Scripts\delete_ax\delete-ORG.sql '|| p_orgid ||' '|| p_axtype||' '|| P_option ; BEGIN execute IMMEDIATE runn; END SCRIPTRUN; Error Messages I'm getting : ORA-00900: invalid SQL statement ORA-06512: at "DWOLFE.SCRIPTRUN", line 17 ORA-06512:

windows下怎样测试oracle安装是否成功以及在oracle中创建用户并赋予用户权限;和[Err] ORA-65096: 公用用户名或角色名无效的解决方案

元气小坏坏 提交于 2021-02-10 08:01:08
测试oracle数据安装是否成功,可 按顺序 执行以下两个步骤: 测试步骤 1: 请执行操作系统级的命令: tnsping orcl 上述命令假定全局数据库名是 orcl。以下是命令执行后的示例( 请在cmd命令窗口手工输入红色部分文字): C:\> tnsping orcl 其中, 结果 OK 至关重要 。 上述结果如果正确,表明侦听器配置无误。 步骤 2: 请执行操作系统级的命令: sqlplus system/password@orcl 上述命令假定 SYSTEM 用户对应的口令是 password,此处输入的password为你实际安装oracle时设置的口令密码。假定全局数据库名是 orcl。 以下是命令执行后的示例(请手工输入红色部分文字): C:\> sqlplus system/password@orcl 接下来 1. 打开Navicat,链接Oracle 2. Ctrl+Q,进入查询窗口创建用户。 创建用户的时候用户名以c##或者C##开头。(具体原因参见Oracle的官方文档https://docs.oracle.com/database/121/DBSEG/users.htm#DBSEG99780)下面是我在官方文档上面截的图 错误写法: create user zyt identified by 1234; 正确写法: create user c##zyt

Retrieve large clob data using sqlplus

帅比萌擦擦* 提交于 2021-02-09 10:51:46
问题 How to completely retrieve large clob data from a table using sqlplus to the stdout? There is a way to get it completely using language specific DB APIs. But when I try to get it using purely sqlplus, I've faced several problems such as, Output buffer is too small (4000 is max) Character string buffer too small Since oracle clob fields can contain 4GB (max) of data, is there any correct way to get the complete data chunk using sqlplus? Can I download it as a file? I hope that the question is