- 浏览: 3223 次
最新评论
linux oracle 重新启动
linux下重启oracle
[oracle@dbOracle9i ~]$lsnrctl stop ----------关闭监听
LSNRCTL for Linux: Version 9.2.0.4.0 - Production on 10-OCT-2011 16:19:02
Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
The command completed successfully
[oracle@dbOracle9i ~]$ sqlplus "/as sysdba" ------sqlplus
SQL*Plus: Release 9.2.0.4.0 - Production on Mon Oct 10 16:19:08 2011
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
SQL> shutdown immediate; -------关闭数据库
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> start up;
SP2-0310: unable to open file "up.sql"
SQL> startup; -------重启数据库
ORACLE instance started.
Total System Global Area 974198740 bytes
Fixed Size 452564 bytes
Variable Size 402653184 bytes
Database Buffers 570425344 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL> exit -------退出sqlplus
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
[oracle@dbOracle9i ~]$ lsnrctl start ---------打开监听
LSNRCTL for Linux: Version 9.2.0.4.0 - Production on 10-OCT-2011 16:20:08
Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.
Starting /home/oracle/product/9.2.0/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 9.2.0.4.0 - Production
System parameter file is /home/oracle/product/9.2.0/network/admin/listener.ora
Log messages written to /home/oracle/product/9.2.0/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbOracle9i)(PORT=1522)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 9.2.0.4.0 - Production
Start Date 10-OCT-2011 16:20:08
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security OFF
SNMP OFF
Listener Parameter File /home/oracle/product/9.2.0/network/admin/listener.ora
Listener Log File /home/oracle/product/9.2.0/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbOracle9i)(PORT=1522)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "lin" has 1 instance(s).
Instance "oravas", status UNKNOWN, has 1 handler(s) for this service...
Service "oravas" has 1 instance(s).
Instance "oravas", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@dbOracle9i ~]$
----------------------
1、lsnrctl stop 查看监听
2、sqlplus / as sysdba
SQL>shutdown immediate; -------关闭数据库
SQL>startup; -------重启数据库
SQL>show user; 查看当前用户:
SQL>show parameter instance_name 查看当前数据库实例:
SQL> exit -------退出sqlplus
3、sql>@full_path/test.sql;
4、添加用户需要两步:
第一步是建立用户:
create user abc ----建立个名为abc的用户
identified by abc123; ----建立密码为abc123;
用户abc已经建立,可以查询用户了。但是没有权限。就是没有使用权,只是有个ABC用户而已。
第二步是给建立的用户授权:
grant connect ,resource,dba to abc; -------给ABC用户授权,访问权,DBA最高权限;
最后提交:
PL/SQL Developer过程化变成语言
orcle自带客户端工具-sqlplus
数据库SZT
oracle表空间1(大小,物理位置),用于规划数据库表
table1
table2
oralce表空间2
table3
table4
一、简单操作
1、创建表空间
SQL>create tablespace test datafile 'E:\Database\data\test_data.dbf' size 20M;
2、重命名表空间
SQL>alter tablespace test rename to test_data;
3、创建表
create table student
(
trandate CHAR(10),
ccy CHAR(3)
) test;
其中test是表空间名字
4、对表结构修改
SQL>alter table student add (class_id number);
SQL>drop table student;删除表
SQL>drop table student cascade constraints;删除表,同时将约束一起删除(当前表主键被其他表用着)
5、查询 group by having
SQL>select distinct name from student where age>21; 剔除重复记录
SQL>select name,age,math from student //where group by having组合
where =
group by name
having(math>98);
6、排序 order by desc(降)、asc(升 默认)
SQL>select name,age,math from student where =
order by math desc;
7、先group by,后order by
二、复杂操作 子查询
1、SQL>select * from student //查询里的子查询
where name in (select name from chengji);
2、SQL>create table tmp_user_objects //建表子查询
as select * from user_objects where 1<>1;
3、SQL>insert into tmp_user_objects //插入语句子查询
select * from user_objiects
where object_type='TABLE'
4、联合语句 union(合并剔除重复)、 union all(合并不剔除重复)、intersect(交集)、minus(减去)、
SQL>select name,age from student
union all/intersect/minus
select name,age from tmp_student;
三、连接(多表)
1、自然连接
SQL>select * from student natural join tmp_student;
2、内连接
SQL>select * from student inner join tmp_student on name;
四、更新操作
1、SQL>insert into student(name,age,math)
select name,age,math
from tmp_student
where age>20;
2、SQL>update student set age=upper(age),name=upper(name) where ;
五、oracle中的字符型
1、列的类型:
character字符型、number数值型、date日期型、LOB大对象
三种字符:char(n)固定长右补齐,varchar(n)可变长不补齐,varchar2(n)可变长不补齐且获得oracle向后兼容的保证
2、PL/SQL声明变量
字符型函数
lpad()、rpad()、lower()、upper()、initcap()、length()、substr()、instr()、ltrim()、rtrim()、trim()、concat()、translate()、
六、Oracle中的数值型 不建议使用integer
1、列的类型:
number(16,2)精度16,小数后的位数2
2、PL/SQL声明变量
abs()、round(3.14,1)、ceil(23.45)、floor(23.45)、mod(5,2)、sqrt(4)、power(4,3)、、
数值型函数
linux下重启oracle
[oracle@dbOracle9i ~]$lsnrctl stop ----------关闭监听
LSNRCTL for Linux: Version 9.2.0.4.0 - Production on 10-OCT-2011 16:19:02
Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
The command completed successfully
[oracle@dbOracle9i ~]$ sqlplus "/as sysdba" ------sqlplus
SQL*Plus: Release 9.2.0.4.0 - Production on Mon Oct 10 16:19:08 2011
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
SQL> shutdown immediate; -------关闭数据库
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> start up;
SP2-0310: unable to open file "up.sql"
SQL> startup; -------重启数据库
ORACLE instance started.
Total System Global Area 974198740 bytes
Fixed Size 452564 bytes
Variable Size 402653184 bytes
Database Buffers 570425344 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL> exit -------退出sqlplus
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
[oracle@dbOracle9i ~]$ lsnrctl start ---------打开监听
LSNRCTL for Linux: Version 9.2.0.4.0 - Production on 10-OCT-2011 16:20:08
Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.
Starting /home/oracle/product/9.2.0/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 9.2.0.4.0 - Production
System parameter file is /home/oracle/product/9.2.0/network/admin/listener.ora
Log messages written to /home/oracle/product/9.2.0/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbOracle9i)(PORT=1522)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 9.2.0.4.0 - Production
Start Date 10-OCT-2011 16:20:08
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security OFF
SNMP OFF
Listener Parameter File /home/oracle/product/9.2.0/network/admin/listener.ora
Listener Log File /home/oracle/product/9.2.0/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbOracle9i)(PORT=1522)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "lin" has 1 instance(s).
Instance "oravas", status UNKNOWN, has 1 handler(s) for this service...
Service "oravas" has 1 instance(s).
Instance "oravas", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@dbOracle9i ~]$
----------------------
1、lsnrctl stop 查看监听
2、sqlplus / as sysdba
SQL>shutdown immediate; -------关闭数据库
SQL>startup; -------重启数据库
SQL>show user; 查看当前用户:
SQL>show parameter instance_name 查看当前数据库实例:
SQL> exit -------退出sqlplus
3、sql>@full_path/test.sql;
4、添加用户需要两步:
第一步是建立用户:
create user abc ----建立个名为abc的用户
identified by abc123; ----建立密码为abc123;
用户abc已经建立,可以查询用户了。但是没有权限。就是没有使用权,只是有个ABC用户而已。
第二步是给建立的用户授权:
grant connect ,resource,dba to abc; -------给ABC用户授权,访问权,DBA最高权限;
最后提交:
PL/SQL Developer过程化变成语言
orcle自带客户端工具-sqlplus
数据库SZT
oracle表空间1(大小,物理位置),用于规划数据库表
table1
table2
oralce表空间2
table3
table4
一、简单操作
1、创建表空间
SQL>create tablespace test datafile 'E:\Database\data\test_data.dbf' size 20M;
2、重命名表空间
SQL>alter tablespace test rename to test_data;
3、创建表
create table student
(
trandate CHAR(10),
ccy CHAR(3)
) test;
其中test是表空间名字
4、对表结构修改
SQL>alter table student add (class_id number);
SQL>drop table student;删除表
SQL>drop table student cascade constraints;删除表,同时将约束一起删除(当前表主键被其他表用着)
5、查询 group by having
SQL>select distinct name from student where age>21; 剔除重复记录
SQL>select name,age,math from student //where group by having组合
where =
group by name
having(math>98);
6、排序 order by desc(降)、asc(升 默认)
SQL>select name,age,math from student where =
order by math desc;
7、先group by,后order by
二、复杂操作 子查询
1、SQL>select * from student //查询里的子查询
where name in (select name from chengji);
2、SQL>create table tmp_user_objects //建表子查询
as select * from user_objects where 1<>1;
3、SQL>insert into tmp_user_objects //插入语句子查询
select * from user_objiects
where object_type='TABLE'
4、联合语句 union(合并剔除重复)、 union all(合并不剔除重复)、intersect(交集)、minus(减去)、
SQL>select name,age from student
union all/intersect/minus
select name,age from tmp_student;
三、连接(多表)
1、自然连接
SQL>select * from student natural join tmp_student;
2、内连接
SQL>select * from student inner join tmp_student on name;
四、更新操作
1、SQL>insert into student(name,age,math)
select name,age,math
from tmp_student
where age>20;
2、SQL>update student set age=upper(age),name=upper(name) where ;
五、oracle中的字符型
1、列的类型:
character字符型、number数值型、date日期型、LOB大对象
三种字符:char(n)固定长右补齐,varchar(n)可变长不补齐,varchar2(n)可变长不补齐且获得oracle向后兼容的保证
2、PL/SQL声明变量
字符型函数
lpad()、rpad()、lower()、upper()、initcap()、length()、substr()、instr()、ltrim()、rtrim()、trim()、concat()、translate()、
六、Oracle中的数值型 不建议使用integer
1、列的类型:
number(16,2)精度16,小数后的位数2
2、PL/SQL声明变量
abs()、round(3.14,1)、ceil(23.45)、floor(23.45)、mod(5,2)、sqrt(4)、power(4,3)、、
数值型函数
相关推荐
在使用这三种数据库时,他们的操作方式各部相同,现对基本操作和一些特殊操作做出如下总结。
通过命了行,完整的备份数据库。分3部操作就可完成。
一些oracle操作,主要是关于SQLPLUS语句
这是从Toad110.6提取出来的、监视使用Oracle数据库的应用程序,执行时对数据库进行操作的sql的工具,包含32位版和64位版,绿色软件,解压缩后就能用。
断电自动保护最大限度防止意外及恶意非法操作 2.1.2后台管理系统 进货管理: 根据销售情况及库存情况,制定进货计划,可以避免盲目进货造成商品积压。 按计划单有选择性地进行自动入库登记。 综合查询打印计划进货...
该网络数据库课件包括:第1章Oracle 10g简介、第2章 数据库和表的创建、第3章 数据库的操作。
Oracle数据库基础及应用实训代码与截图,包括Oracle数据库的基本操作。
命令行导入导出Oracle数据库操作,操作简单,比用工具而且快
orcle数据库连接工具,PLSQL链接工具,更好的对orcle进行操作
Oracle创建主键自增表,Oracle的基本操作+Oracle字段类型,命名规则和注意事项
第4章 数据库的查询和视图、第5章 PLSQL介绍、第6章 存储过程和触发器、第7章 系统安全管理、第8章 数据库备份和恢复、第9章 闪回操作和Undo、第10章 其他概念。
Oracle事务处理的基本操作,可以好好学习一下。 希望有用,对大家学习数据库有很大帮助
C# ORCLE数据库 对于BLOB字段的操作,查询BLOB字段,插入,更新。
数据安全性:实体级数据库存取和使用控制,如可以访问的对象以及可以进行的操作(查询,更新等) Oracle 帐户: SYS:具有dba角色的管理帐户,sys方案中的任何表和视图不能由任何其他数据库管理员操作 SYSTEM /...
包括安装、建表、设置权限、和基本的SQL操作 初学者必看
当进行ORACLE数据库的插入、修改、删除操作时,要进行提交,否则可能会占用一个会话,从而出现死锁的状态.
数据库管理工具支持大部分主流的数据库,解压后直接打开就行,支持sqlserver、mysql、sqlite、orcle、access、DB2 等接近二十种数据库的操作。 开发语言基于C#,需要在Windows操作系统下使用。 可以快速实现日常运维...
ORACLE日常操作手册,希望对大家有用。
审计(Audit)用于监视用户所执行的数据库操作,并且Oracle会将审计跟踪结果存放到OS文件(默认位置为$ORACLE_BASE/admin /$ORACLE_SID/adump/) 或数据库(存储在system表空间中的SYS.AUD$表中,可通过视图dba_audit...
//点击更新按钮的操作 getname=jtfArray[1].getText().trim(); System.out.println("test:"+getname); if(getname!=null&&!getname.equals("")) { //拼装SQL语句 String sql = "select name ...