Using Oracle Index Hints in SQL statements
Hints are used to give specific information that we know about our data and application, to Oracle. This further improves the performance of our system. There can be instances where the default optimizer may not be efficient for a certain SQL statements. We can specify HINTS with the SQL statements, to improve the efficiency of those SQL statements.
In this article, we shall see how to specify INDEX hints and what the advantages of the same are.
1 How to specify Hints
The Hints are enclosed in comment, /* comment */, in an SQL statement, and can only be specified with SELECT, DELETE and UPDATE keyword.
SELECT /* comment */ ........ ;
All hints should start with a + sign. This tells the SQL Parser that the SQL has a hint specified with it.
SELECT /*+{hint} */ ........ ;
2 Using INDEX Hints
When you specify an INDEX Hint, the optimizer knows that it has to use the INDEX specif ......
Using Oracle Index Hints in SQL statements
Hints are used to give specific information that we know about our data and application, to Oracle. This further improves the performance of our system. There can be instances where the default optimizer may not be efficient for a certain SQL statements. We can specify HINTS with the SQL statements, to improve the efficiency of those SQL statements.
In this article, we shall see how to specify INDEX hints and what the advantages of the same are.
1 How to specify Hints
The Hints are enclosed in comment, /* comment */, in an SQL statement, and can only be specified with SELECT, DELETE and UPDATE keyword.
SELECT /* comment */ ........ ;
All hints should start with a + sign. This tells the SQL Parser that the SQL has a hint specified with it.
SELECT /*+{hint} */ ........ ;
2 Using INDEX Hints
When you specify an INDEX Hint, the optimizer knows that it has to use the INDEX specif ......
转帖处:http://dong-java.javaeye.com/blog/375150
1。推荐使用Oralce比较新的10.2.0.3 JDBC Drivers。这个版本对比9.2的最大的好处是DriverManager.setLoginTimeout函数是起作用的。设置了这个参数,在恶劣的网络环境中就不会有连接数据库的函数长时间不返回的情况。
2。JDBC Developer!ˉs Guide and Reference 10g Release 2 (10.2)
给出的连接数据库的示例:
import java.sql.*;
import oracle.jdbc.pool.OracleDataSource;
class JdbcTest {
public static void main (String args []) throws SQLException {
// Create DataSource and connect to the local database
OracleDataSource ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:@//myhost:1521/orcl");
ods.setUser("scott");
......
转帖处:http://dong-java.javaeye.com/blog/375150
1。推荐使用Oralce比较新的10.2.0.3 JDBC Drivers。这个版本对比9.2的最大的好处是DriverManager.setLoginTimeout函数是起作用的。设置了这个参数,在恶劣的网络环境中就不会有连接数据库的函数长时间不返回的情况。
2。JDBC Developer!ˉs Guide and Reference 10g Release 2 (10.2)
给出的连接数据库的示例:
import java.sql.*;
import oracle.jdbc.pool.OracleDataSource;
class JdbcTest {
public static void main (String args []) throws SQLException {
// Create DataSource and connect to the local database
OracleDataSource ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:@//myhost:1521/orcl");
ods.setUser("scott");
......
我的机器改了计算机名称,再开机时,oracle出现问题,开机时老是报“agntsrvc.exe出错”,经过搜索发现是下列问题:
1.agntsrvc.exe是Oracle Intelligent Agent服务对应的程序。
2.因此服务是自动启动的,所以一般多在电脑启动时弹出系统错误。
3.问题处理:(本备份养成习惯哦)
删除了 %ORACLE_HOME%/ora92/Network/agent 下,所有后缀名为Q的文件。
提示: 再重新启动Oracle Intelligent Agent ,一切OK。
============================================
网上还有一些方法,仅供参考。
方法一:
微软新闻组的朋友指点:开始--运行:regsvr32 jscript.dll
开始--运行:regsvr32 vbscript.dll
不过没解决---但提供了路子-----一次运行注册所有dll
搜索查找到方法如下:
运行 输入cmd 回车在命令提示符下输入
for %1 in (%windir%\system32\*.dll) do regsvr32.exe /s %1
这个命令老兄你慢慢输 输入正确的话会看到飞快地滚屏 否则……否则失败就是没这效果。回车后慢慢等(需要点时间1-2分钟) 都运行完再打开看 ......
oracle 中,对于一个提交的sql语句,存在两种可选的解析过程, 一种叫做硬解析,一种叫做软解析.
一个硬解析需要经解析,制定执行路径,优化访问计划等许多的步骤.硬解释不仅仅耗费大量的cpu,更重要的是会占据重要的们闩(latch)资源,严重的影响系统的规模的扩大(即限制了系统的并发行), 而且引起的问题不能通过增加内存条和cpu的数量来解决。
之所以这样是因为门闩是为了顺序访问以及修改一些内存区域而设置的,这些内存区域是不能被同时修改。当一个sql语句提交后,oracle会首先检查一下共享缓冲池(shared pool)里有没有与之完全相同的语句,如果有的话只须执行软分析即可,否则就得进行硬分析。
而唯一使得oracle 能够重复利用执行计划的方法就是采用绑定变量。绑定变量的实质就是用于替代sql语句中的常量的替代变量。绑定变量能够使得每次提交的sql语句都完全一样。
绑定变量只是起到占位的作用,同名的绑定变量并不意味着在它们是同样的,在传递时要考虑的是传递的值与绑定变量出现顺序的对位,而不是绑定变量的名称。
绑定变量是在通常情况下能提升效率,非正常的情况如下:
在字段(包括字段集)建有索引,且字段(集)的集的势非常大 ......
一、新建databack.sh文件,存放目录/opt/databack/
#数据库用户资料
USERNAME=数据库用户名(信息隐藏)
PASSWORD=数据库密码(信息隐藏)
#FTP服务器信息
FTP_SERV=FTP服务器(信息隐藏)
FTP_USER=FTP用户名(信息隐藏)
FTP_PASS=FTP密码(信息隐藏)
FTP_DIR=FTP目录(信息隐藏)
#备份目录
BACKUP_DIR=/opt/databack
#格式化日期
DATE=`date +%Y%m%d`
#定义三个实例
EXP1=第一个ORACLE实例名称(信息隐藏)
EXP2=第二个ORACLE实例名称(信息隐藏)
EXP3=第三个ORACLE实例名称(信息隐藏)
#开始备份第一个实例
export ORACLE_SID=${EXP1}
if [ -f ${BACKUP_DIR}/${EXP1}/${EXP1}_${DATE}.dmp ]; then
echo exp ${EXP1} `date +%Y-%m-%d` backup file already exists.
else
exp ${USERNAME}/${PASSWORD} file=${BACKUP_DIR}/${EXP1}/${EXP1}_${DATE}.dmp
fi
#注释:如果备份目录下存在当日的备份文件,则输出“文件已存在”的提示信息,如果没有,则备份文件。
#开始备份第二个实例
export ORACLE_SID=${EXP2}
if [ -f ${BACKUP_DIR}/${EXP2}/${EXP2}_${DATE}.dmp ]; then
echo exp ${EXP ......
如果web方式的em,isqlplus访问不了。
1. 检查主机名/IP、端口是否正确
安装时的主机名/IP、端口记录在$ORACLE_HOME/install/portlist.ini 文件中。
缺省是:
一般用户 http://ip:5560/isqlplus
DBA用户 http://ip:5560/isqlplus/dba
EM Database Control http://ip:1158/em/
2. 看em, isqlplus服务是否起启动,状态是否正常
当然Oracle安装时,要选择安装了“Oracle Enterprise Manager配置数据库”
其它问题:
3. 换了ip需要重建em,以下是em的相关命令:
创建一个EM资料库
emca -repos create
重建一个EM资料库
emca -repos recreate
删除一个EM资料库
emca -repos drop
配置数据库的 Database Control
emca -config dbcontrol db
删除数据库的 Database Control配置
emca -deconfig dbcontrol db
重新配置db control的端口,默认端口在1158
emca -reconfig ports
emca -reconfig ports -dbcontrol_http_port 1160 ......