zoukankan      html  css  js  c++  java
  • oracle相关命令收集-张

    orcle相关命令收集

    1,用管理员登陆
    /as sysdba;
    2, 更改用户密码
    alter user name identified by password;
    alter user exptest identified by exptest;
    查询用户名:
    select username,password from dba_users;
    3,连接用户名
    conn name/password;
    4,创建用户名
    create user coco identified by coco;
    create user exptest identified by D33gw1TYs;

    4.1授权
    create user accf identified by accf;
    alter user accf default tablespace oa_data;
    alter user accf quota unlimited on oa_data;
    grant create session to accf;
    grant create table to accf;
    grant create tablespace to accf;
    grant create view to accf;
    grant alter tablespace to accf;
    grant dba to accf;
    grant select ,insert(sno,cno),update on sscc to coco--为用户对象付特权
    4.2创建用户给默认表空间
    create user username identified by password default tablespace user_data;
    create tablespace OA_DATA datafile 'D: oa_data.dbf' size 50m autoextend on
    next 50m maxsize 512m extent management local;
    4.3为用户指定表空间
    alter user coco default tablespace OA_DATA;
    5,查询所有空间
    select tablespace_name from dba_tablespaces;
    6,修改用户默认表空间
    alter user coco default tablespace oatest;
    7,查询用户自己所在的表空间
    select username,default_tablespace from user_users;
    8, 查询数据库的sid
    show parameter instance_name;
    9,查看sid
    select instance_name from v$instance;
    10,判断连接
    telnet 127.0.0.1 1521
    ping 10.132.21.18
    11,登陆远程sql plus
    conn exptest/cc@10.132.21.18/oatest;
    //10.132.21.18:1521:oatest
    12, 创建数据库之间的连接dblink
    create database link linkexp
    connect to exptest identified by D33gw1TYs
    using '(DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.132.21.18)(PORT = 1521))
    )
    (CONNECT_DATA =
    (SERVICE_NAME = oatest)
    )
    )';

    13,删除dblink
    Drop public DATABASE LINK linkme;
    Drop DATABASE LINK linkme;
    14,tnsnames.ora配置
    D:appAdministratorproduct11.2.0client_1 etworkadmin nsnames.ora,
    # tnsnames.ora Network Configuration File: D:appAdministratorproduct11.2.0dbhome_2NETWORKADMIN nsnames.ora
    # Generated by Oracle configuration tools.

    LISTENER_ORCL =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))


    ORCL =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
    (CONNECT_DATA =
    (SID = orcl)
    (SERVER = DEDICATED)
    (SERVICE_NAME = orcl)
    )
    )

    15,oracle卸载
    运行regedit,删除HKEY_LOCAL_MACHINESOFTWAREORACLE
    HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServices,滚动 这个列表,删除所有Oracle入口。
    HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesEventlogApplication, 删除所有Oracle入口。

    16, 管理员权限
    grant dba to coco;
    --Revoke dba from coco;

    17, 迁移数据库
    当本地用户名与服务器端不一致时,需要在本地建立一个相同的用户
    17.1导入数据库
    @d:/EE.sql
    PL/SQL中直接写@

    18, 查看用户空间下所有的表
    -- connect xx/xx 切换到这个用户
    select * from tab;

    19,共享命令,安装12c时用到:net share nu=c: /grant:everyone,full

    20,导出命令exp coco/coco@orcl file=d:exp.dmp full=y;
    exp exptest/exptest@localhost:1521/orcl file=d:exp.dmp full=y;
    exp exptest/D33gw1TYs@10.132.21.18/oatest file=d:exp.dmp;
    exp oapre/Cq#1988@10.132.21.18/oapre file=d:oapre.dmp;
    url="jdbc:oracle:thin:@10.132.21.18:1521:oapre"
    username="oapre"
    password="Cq#1988"

    imp accf/accf file=uat.dmp fromuser=oapre touser=accf tablespaces=users;
    imp coco/coco file=uat.dmp fromuser=oapre touser=accf tablespaces=users;


    20.1、导出指定表:exp 用户名/密码@数据库名 file=c:filename.dmp tables=(table1,table2).
    必须在括号中列出所有表名。
    20.2、导出特定用户所有表:exp 用户名/密码@数据库名 file=c:filename.dmp owner=用户名

    21,查询有clob字段的表
    select distinct('TABLE "'||a.OWNER ||'"."'||a.TABLE_NAME||'"') from sys.all_tab_columns a
    where a.OWNER = 'EXPTEST' and a.TABLE_NAME not in (
    select t.TABLE_NAME from sys.all_tab_columns t
    where t.OWNER = 'EXPTEST' and t.DATA_TYPE in ('CLOB','BLOB')
    );

    22,误操作
    22.1删除之前闪回
    flashback table AA to before drop;
    22.2指定时间之前闪回
    alter table AA enable row movement;
    flashback table AA to timestamp to_timestamp('2016-02-18 10:25:21','yyyy-mm-dd hh24:mi:ss');
    22.3通过查询闪回
    select * from AA as of timestamp TO_TIMESTAMP('2016-02-19 13:36:05', 'yyyy-mm-dd hh24:mi:ss');

  • 相关阅读:
    swift 第十四课 可视化view: @IBDesignable 、@IBInspectable
    swift 第十三课 GCD 的介绍和使用
    swift 第十二课 as 的使用方法
    swift 第十一课 结构体定义model类
    swift 第十课 cocopod 网络请求 Alamofire
    swift 第九课 用tableview 做一个下拉菜单Menu
    swift 第八课 CollectView的 添加 footerView 、headerView
    swift 第七课 xib 约束的优先级
    swift 第六课 scrollview xib 的使用
    swift 第五课 定义model类 和 导航栏隐藏返回标题
  • 原文地址:https://www.cnblogs.com/wuer888/p/7479047.html
Copyright © 2011-2022 走看看