zoukankan      html  css  js  c++  java
  • Oracle数据库、用户与表的操作

    一、数据库、用户及表的管理
    
    创建数据库:
      create database dbname; 删除数据库:
      drop database dbname; 创建名称空间:
      create tablespace tsname; datafile
    'c:\tsname.dbf'; size 100m; autoextend on; next 10m;(tsname为表空间名称,datafile 用于设置物理文件名称,size 用于设置表空间的初识大小,autoextend on 用于设置自动增长,如果存储量超过初始大小,则开始自动扩容,next 用于设置扩容的空间大小) 创建新用户:
      create user1 identified by password1
    default tablespace tsname; 用户赋权:
      grant dba to user1;grant connect to user1; 创建新表:
      create table tname(col1 type1 (not
    null) [primary key],col2 type2(not null)); 根据已有的旧表创建新表:
      select
    * into newtable from oldtable; 修改表某列列明:
      alter table tname rename column c1 to c2; 增加列:
      alter table tname add column col; 删除列:
      alter table tname drop column col; 删除用户:
      drop user username cascade; 二、数据库数据的操作(导入及导出) 导出数据库中所有数据:   exp user1
    /password1 file=d:\test.dmp statistics=none; 导出数据库中部分表全部数据:   exp user1/password1 file=d:\test.dmp statistics=none TABLES=(TABLE1,TABLE2,TABLE3...); 导出数据库中部分表部分数据:   exp user1/password1 file=d:\test.dmp statistics=none TABLES=(TABLE1,TABLE2,TABLE3...)QUERY="WHERE rownum <= 1000";
  • 相关阅读:
    需求获取过程中的逆向沟通
    程序员==生 涯 篇
    算法设计
    灯的启示:微软对唐骏的面试题
    使用Gzip压缩提升WEB服务器性能
    简历误区
    招聘编辑的七道面试题
    web2.0及其相关技术
    经典面试题助你成功就业
    逗号网站推广营销策略
  • 原文地址:https://www.cnblogs.com/bishuihengchen/p/8056830.html
Copyright © 2011-2022 走看看