玩转Oracle(2)
sql*plus 命令
//执行脚本
@和start d:/a.txt;
//修改脚本
edit d:/a.txt;
//将内容输入到文本中
sloop d:/a.txt; //开始记录屏幕内容
sloop off; //记录结束
//链接登录数据库
connect system/919959 as sysdba/sysoper; //权限最大dba
connect sys/919959;
connect scott/tiger;
//创建用户
create user valen identified by 919959; //创建完成后并不能够登录,需要授权
//当前用户
show user;
//删除用户
drop user valen;
//授权
grant connect to valen; //登录的权限
grant resource to valen; //建表的权限
grant select on emp to valen; //将对象操作权限给予某一个用户,假设当前用户为scott,将scott的emp表的select权限赋给valen
grant update on emp //更新权限
grant inset on emp //添加权限
grant delete on emp //删除权限
grant all on emp //当前表的所有权限
//收回权限
revoke select on emp from valen; //从valen用户收回对emp表的select权限
//查询其他用户的表的权限
select * from scott.emp //查询scott用户下emp表
//权限的维护
//对象权限
scott将权限传给了valen,并希望valen将该选线继续传递给下一个用户
grant select on emp to valen with grant option //如果是对象权限就加入with grant option
//系统权限
grant connect to valen with admin option //如果是系统权限就加入with admin option
如果scott收回了valen的权限,则valen授权给tom的权限也被收回了
//使用profile管理用户口令
创建profile文件
create profile lock_account //创建规则lock_account
limit //关键字
failed_login_attempts 3 //给予3次登录机会
password_lock_time 2; //锁定2天
//更改用户遵循此规则
alter user tom profile lock_account;
//给账户解封
alter user tom account unlock; //给指定用户解封
//终止口令
create profile myprofile //创建规则myprofile
limit
password_life_time 10 //每10天修改登录密码
password_grace_time 2 //宽限期为2天
password_reuse_time 10 //指定口令可重用时间即10天后就可以重用
//
相关文档:
Mysql方式:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class MysqlDB {
private String strClass = "com.mysql.jdbc.Driver";
private String strDriver = "jdbc:mysql://localhost: ......
相信大家看了这篇文章对Oracle如何工作有一个形象的了解!
摘自----《Oracle备份与恢复》
-----------------------------------------------------------------------------------------------------------------
一个名叫Sid的男人,狂热地爱好拍摄、保存和整理照片。Sid的妻子名叫Debbie,他们有三个儿子Logan、Archie ......
--==================================== 一.sql语句方面 ====================================================
--========================================================================================================
1.增加主键
alter table TABLE_NAME add constraint KEY_NAME primary key ......
Oracle与SQL Server事务处理的比较
事务处理是所有大型数据库产品的一个关键问题,各数据库厂商都在这个方面花费了很大
精力,不同的事务处理方式会导致数据库性能和功能上的巨大差异。
事务处理也是数据库管理员与数据库应用程序开发人员必须深刻理解的一个问题,对这个问题的疏忽可能会导致应用程序逻辑错 ......