1.Oracle初始口令:
internal/oracle
sys/change_on_install
system/manager
scott/tiger
转载:
internal/oracle
sys/change_on_install
system/manager
scott/tiger
sysman/oem_temp
2.用户解锁:
ALTER USER username ACCOUNT UNLOCK;
3.创建表空间
create tablespace onlineBook
datafile 'D:\oracle\product\10.2.0\oradata\orcl\onlineBook.dbf' size 50M
default storage(
initial 500k
Next 500k
minextents 1
maxextents unlimited
pctincrease 0)
/
4.创建用户:
create user test identified by test default tablespace onlinebook;
5.删除用户:
drop user test cascade;
6.给用户授权:
grant resource , connect ,dba to test;
给用户授权
- grant dba to lxg;--授予DBA权限
- grant unlimited tablespace to lxg;--授予不限制的表空间
- grant select any table to lxg;--授予查询任何表
- grant select any dictionary to lxg;--授予 查询 任何字典
- grant dba to lxg;
- grant unlimited tablespace to lxg;
- grant select any table to lxg;
- grant select any dictionary to lxg
7.增加表空间
alter tablespace chinawater add datafile 'c:\oracle\oradata\orcl9\ADDCHINAWATER.dbf' size 200M
8.删除表空间
drop tablespace "空间名" including contents and datafiles
oracle操作语句:
1.创建表
create table 表名(
列名1 类型,
列名2 类型
);
2.修改类属性
alter table 表名 modify(列名 类型);
3.添加列
alter table 表名 add(列名 类型);
4.添加主键约束和非空约束
alter table 表名 add constraint pk_表名 primary key(列名);
alter table 表名 modify(列名 not null);
5.删除主键约束
alter table 表名 drop primary key;
alter table 表名 drop constraint pk_表名;
6.失效约束
alter table 表名 disable primary key;
alter table 表名 disable constraint pk_表名;
7.有效约束
alter table 表名 enable primary key;
alter table 表名 enable constraint pk_表名;
8.删除列
alter table 表名 drop column 列名;
9.设置某列不可用,然后删除
alter table 表名 set unused(列名);
alter table 表名 drop unused columns;
10.修改表名
rename 表名1 to 表名2
alter 表名1 rename to 表名2;
11.截断表
truncate table 表名;
12.截断表保留行空间
truncate table 表名 resue storage;
13.查看表结构
desc table 表名;
14.删除表
drop table 表名;
15.插入记录
例:insert into 表名 values(内容1,内容2,内容3,内容4);
16.带参数对话方式插入行
例:insert into 表名 values(&列名1,&列名2);
insert into 表名 values(内容1,内容2);
17.插入某几列记录
insert into 表名(列名1,列名2) values(内容1,内容2);
18.为列插入空值(其列不能为not null)
insert into 表名 values(内容1,null,null);
19.创建表(包括主键及外键设置)方法一
create table 表名(
列名1 类型
constraint pk_表名 primary key,
列名2 类型 not null,
列名3 类型
constraint fk_表名 reference 表名(列名),
列名3 类型
constraint ......
1.创建表
create table 表名(
列名1 类型,
列名2 类型
);
2.修改类属性
alter table 表名 modify(列名 类型);
3.添加列
alter table 表名 add(列名 类型);
4.添加主键约束和非空约束
alter table 表名 add constraint pk_表名 primary key(列名);
alter table 表名 modify(列名 not null);
5.删除主键约束
alter table 表名 drop primary key;
alter table 表名 drop constraint pk_表名;
6.失效约束
alter table 表名 disable primary key;
alter table 表名 disable constraint pk_表名;
7.有效约束
alter table 表名 enable primary key;
alter table 表名 enable constraint pk_表名;
8.删除列
alter table 表名 drop column 列名;
9.设置某列不可用,然后删除
alter table 表名 set unused(列名);
alter table 表名 drop unused columns;
10.修改表名
rename 表名1 to 表名2
alter 表名1 rename to 表名2;
11.截断表
truncate table 表名;
12.截断表保留行空间
truncate table 表名 resue storage;
13.查看表结构
desc table 表名;
14.删除表
drop table 表名;
15.插入记录
例:insert into 表名 values(内容1,内容2,内容3,内容4);
16.带参数对话方式插入行
例:insert into 表名 values(&列名1,&列名2);
insert into 表名 values(内容1,内容2);
17.插入某几列记录
insert into 表名(列名1,列名2) values(内容1,内容2);
18.为列插入空值(其列不能为not null)
insert into 表名 values(内容1,null,null);
19.创建表(包括主键及外键设置)方法一
create table 表名(
列名1 类型
constraint pk_表名 primary key,
列名2 类型 not null,
列名3 类型
constraint fk_表名 reference 表名(列名),
列名3 类型
constraint ......