- 浏览: 153675 次
- 性别:
- 来自: 深圳
-
文章分类
最新评论
--李丹给的 建表空间和数据库的语句
--Create TableSpace
create tablespace cmcs_hb_test datafile 'E:\oracle\product\10.2.0\oradata\ORCL\cmcs_hb_test.DBF'
size 1000m
/*(autoextend on)*/
autoextend on
next 32m maxsize 2048m
extent management local;
-- Create the user
create user cmcs_gx
identified by "cmcs_gx"
default tablespace cmcs_gx
temporary tablespace TEMP
profile DEFAULT;
-- Grant/Revoke role privileges
grant connect to cmcs_gx;
grant resource to cmcs_gx;
-- Grant/Revoke system privileges
grant create database link to cmcs_gx;
grant create materialized view to cmcs_gx;
grant create procedure to cmcs_gx;
grant create public synonym to cmcs_gx;
grant create role to cmcs_gx;
grant create sequence to cmcs_gx;
grant create synonym to cmcs_gx;
grant create table to cmcs_gx;
grant create trigger to cmcs_gx;
grant create type to cmcs_gx;
grant create view to cmcs_gx;
grant unlimited tablespace to cmcs_gx;
--导出数据库中所有表:
exp tas_gx/tas_gx@192.168.0.101/orcl file='d:\a.dmp' full=y;
--导出数据库中指定的某几张表
exp cmbbcd/wzg0207788020778@10.36.31.5:1521/BCDL file=D:\BCDL_HB.dmp tables=(cmcs3_payment_list ,cmcs3_transfer_bill)
--导入表,要删除本地的 table , view ,sequence,然后导入
imp bcdl_hb/bcdl_hb@192.168.0.136/orcl file=c:/bcdl_hb.dmp full=y
--oracle sys 密码
sys change_on_install
system manager
--如下是修改sys 和 system 的密码
conn / as sysdba
alter user system identified by 'manager';
alter user sys identified by 'change_on_install';
--oracle查看索引信息
user_indexes: 系统视图存放是索引的名称以及该索引是否是唯一索引等信息。
user_ind_column: 系统视图存放的是索引名称,对应的表和列等
--查看索引个数和类别:
SQL> select * from user_indexes where table='表名'
查看索引被索引的字段:
SQL> select * from user_ind_columns where index_name=upper('&index_name');
--我们可以通过类似下面的语句来查看一个表的索引的基本情况:
select user_ind_columns.index_name,user_ind_columns.column_name,
user_ind_columns.column_position,user_indexes.uniqueness
from user_ind_columns,user_indexes
where user_ind_columns.index_name = user_indexes.index_name
and user_ind_columns.table_name = ‘你想要查询的表名字’;
--建立一个唯一索引
ALTER TABLE CMCS3_FARE ADD CONSTRAINT VOUCHERNO_UNIQUE UNIQUE (NAME);
--删除一个唯一索引
ALTER TABLE CMCS3_FARE drop CONSTRAINT VOUCHERNONAME_UNIQUE;
--Create TableSpace
create tablespace cmcs_hb_test datafile 'E:\oracle\product\10.2.0\oradata\ORCL\cmcs_hb_test.DBF'
size 1000m
/*(autoextend on)*/
autoextend on
next 32m maxsize 2048m
extent management local;
-- Create the user
create user cmcs_gx
identified by "cmcs_gx"
default tablespace cmcs_gx
temporary tablespace TEMP
profile DEFAULT;
-- Grant/Revoke role privileges
grant connect to cmcs_gx;
grant resource to cmcs_gx;
-- Grant/Revoke system privileges
grant create database link to cmcs_gx;
grant create materialized view to cmcs_gx;
grant create procedure to cmcs_gx;
grant create public synonym to cmcs_gx;
grant create role to cmcs_gx;
grant create sequence to cmcs_gx;
grant create synonym to cmcs_gx;
grant create table to cmcs_gx;
grant create trigger to cmcs_gx;
grant create type to cmcs_gx;
grant create view to cmcs_gx;
grant unlimited tablespace to cmcs_gx;
--导出数据库中所有表:
exp tas_gx/tas_gx@192.168.0.101/orcl file='d:\a.dmp' full=y;
--导出数据库中指定的某几张表
exp cmbbcd/wzg0207788020778@10.36.31.5:1521/BCDL file=D:\BCDL_HB.dmp tables=(cmcs3_payment_list ,cmcs3_transfer_bill)
--导入表,要删除本地的 table , view ,sequence,然后导入
imp bcdl_hb/bcdl_hb@192.168.0.136/orcl file=c:/bcdl_hb.dmp full=y
--oracle sys 密码
sys change_on_install
system manager
--如下是修改sys 和 system 的密码
conn / as sysdba
alter user system identified by 'manager';
alter user sys identified by 'change_on_install';
--oracle查看索引信息
user_indexes: 系统视图存放是索引的名称以及该索引是否是唯一索引等信息。
user_ind_column: 系统视图存放的是索引名称,对应的表和列等
--查看索引个数和类别:
SQL> select * from user_indexes where table='表名'
查看索引被索引的字段:
SQL> select * from user_ind_columns where index_name=upper('&index_name');
--我们可以通过类似下面的语句来查看一个表的索引的基本情况:
select user_ind_columns.index_name,user_ind_columns.column_name,
user_ind_columns.column_position,user_indexes.uniqueness
from user_ind_columns,user_indexes
where user_ind_columns.index_name = user_indexes.index_name
and user_ind_columns.table_name = ‘你想要查询的表名字’;
--建立一个唯一索引
ALTER TABLE CMCS3_FARE ADD CONSTRAINT VOUCHERNO_UNIQUE UNIQUE (NAME);
--删除一个唯一索引
ALTER TABLE CMCS3_FARE drop CONSTRAINT VOUCHERNONAME_UNIQUE;
发表评论
文章已被作者锁定,不允许评论。
-
数据归档的方法
2016-02-21 18:35 593--数据归档的方法create or replace pr ... -
ORACLE跟新数据的性能提升(通过中间表)
2016-02-21 18:35 622--更新历程权力值--1.查询效率慢的update FW_ ... -
JBPM的表相关操作
2016-02-21 18:35 564--通过流程的编码获取该对应的流程定义 select * ... -
一套oracle面试题笔试题以及参考答案
2014-12-22 23:35 760http://blog.sina.com.cn/s/blog ... -
oracle循环语句的几种使用方法(转载)
2014-12-22 23:32 611主要有以下五种循环: ... -
左连接右连接
2015-03-01 22:36 550对于外连接:Oracle中可以使用“(+) ”来表示,9i ... -
复制一个表到另一个表、视图、临时表
2014-10-12 21:26 448Oracle数据结构软件测试SQL 创建一个表n ... -
将EXCEL导入到数据库
2014-07-30 20:51 503用PLSQL Developer工具。 1 ... -
关于oracle with as用法
2014-06-26 20:32 851with as语法–针对一个别名with tmp as (s ... -
tomcat配置数据库连接池
2014-05-04 21:21 6381.所有的tomcat项目共用一个连接池配置:在tomcat ... -
关于SQL优化方面的建议
2014-01-29 23:13 5642014-01-25 SQL优化主 ... -
connect by prior start with
2014-01-08 22:48 500在oracle中通过connect by prior来实 ... -
from v sql v session where sqlid = sqlid
2014-01-08 22:44 589--博客,细节可以进去看 http://blog.csdn ... -
统计支付成功金额最大的前三十个供应商1-5w等支付笔数.sql
2013-12-12 15:34 617select a.payeename,(select co ... -
sql select case when group by 行转列
2013-12-10 17:30 849XJrain表里存放每天的雨量,我想一次显示过去一天,过去 ... -
Oracle中查看已执行sql的执行计划
2013-12-10 16:43 558有时候我们可能会希望查看一条已经执行过的sql的执行计划,常 ... -
统计失效视图
2013-09-18 19:59 645--统计失效视图个数和视图名称 (0 个失效) ... -
ORA-00054 的解决方法
2013-07-12 11:52 1002系统有一个不用的索引,想删除这个索引, SQL> ... -
防止 SQL注入
2013-01-30 13:52 650web.xml 中配置如下 <filter-map ... -
SQL 处理
2012-12-17 16:33 773--查询数据库字段相加,同时对金额字段进行处理 and ...
相关推荐
Oracle数据库-建库、建表空间
在数据库管理中,"表空间"是Oracle数据库中的一个重要概念。它是一个物理存储区域,用于容纳数据库对象,如表、索引和视图。自动创建数据库工具的一个关键功能是能够自动创建表空间,这通常涉及到设置表空间大小、...
在Oracle 10g数据库管理系统中,创建表空间、数据链路、同义词、序列号和视图是管理和操作数据库的重要环节。下面将详细解释这些概念及其创建语句。 **1. 创建表空间(Tablespaces)** 表空间是Oracle数据库中存储...
本资源"SQL建库建表.rar"显然是关于如何使用SQL进行数据库建设和表结构设计的教程或源码示例。 1. **SQL基础知识**:SQL分为DDL(Data Definition Language)和DML(Data Manipulation Language)两大部分。DDL用于...
包里还有一些以前自己的学习文档,包括(用PLSQL远程连接Oracle数据库、Oracle数据库-建库、建表空间,建用户、oracle 用户被锁定解锁方法、Oracle 10g dmp文件的导入导出)等文档,方便大家的学习,资源丰富.
- 创建使用UNICODE编码的生产数据库,并且不设置特定的表空间(与Oracle的概念不同)。 - 库建立后创建schema,与Oracle中的用法相似。 - PostgreSQL的权限管理严格,未特别声明的对象都会在public schema下创建...
系统权限包括建库、建表等;对象权限则涉及对特定数据对象的操作权限。 - **使用Profile管理用户口令**:Profile用于设置口令的有效期、复杂度等限制条件。 通过上述知识点的学习和理解,可以帮助初学者更好地掌握...
--建表空间 CREATE TABLESPACE jyzx DATAFILE 'jyzx' SIZE 500M AUTOEXTEND ON NEXT 50M MAXSIZE unlimited LOGGING ONLINE PERMANENT EXTENT MANAGEMENT LOCAL AUTOALLOCATE BLOCKSIZE 8K SEGMENT SPACE ...
PD只能生成Oracle的建库脚本一个部分,所以如果要创建Oracle数据库还是要使用DBCA。 创建表空间需要在物理数据模型上new——TableSpace,创建表空间,输入表空间的显示名和数据库真实名称。可以选择表空间要配置的...
表空间是Oracle数据库中的一种逻辑存储结构,用于组织和管理数据。`maxdata`表空间被创建,并且指定了数据文件的位置和大小。自动扩展功能(`autoextendon`)确保随着数据的增长,表空间可以自动增加容量,避免了手动...
- DDL(Data Definition Language):创建和修改数据库结构,如建表、建库。 - DML(Data Manipulation Language):操作数据,包括增、删、改。 - DCL(Data Control Language):权限控制,如GRANT和REVOKE。 ...
数据库设计是IT行业中至关重要的一个环节,特别是在关系型数据库管理系统(RDBMS)如SQL Server、Oracle等的应用中。这份PPT着重介绍了数据库设计的基础知识和步骤,对于初学者和专业开发者都具有很高的参考价值。 ...