zoukankan      html  css  js  c++  java
  • 数据库视频笔记

    第一天:视频4
    database
    1.parameter pfile(spfile:server parameter,用show parameter spfile查看)
    2.instance;
    1.sga
    a.data buffer cache
    b.shared pool
    2 select * from v$process
    select * from v$session

    sqlplus / as sysdba
    启动和停止数据库要用sysdba,
    1shutdown immediate,关闭数据库
    2startup启动数据库
    进入监听功能:在cmd里直接敲入:lsnrctl

    启动数据库
    第一个阶段

    启动数据库到unmount状态,也就是实例起来:startup nomount
    show parameter spfile
    第二个阶段,由nomount到mount
    从unmount状态到mount状态
    alter database mount;用到了控制文件
    select status form v$instance;查看实例状态
    select name form v$controlfile;
    mount的时候用到了控制文件
    第三个阶段open阶段
    open阶段数据库才真正用到了数据文件和日志文件。
    通过控制文件就可以找到数据文件盒日志文件,控制文件记录了数据文件和日志文件的位置
    alter database mount
    视频5
    强制重启:startup force(相当于断电重启,内存里的所有东西都没有了)

    视频6

    修改和重建口令文件的方法。搜索“os认证和口令文件”和“指定口令文件的环境变量”

    7
    create tablespace test datafile 'e:\oracle\test.dbf' size 10m;
    create table t1 (id int) tablespace test;

    select * from dba_segments where segment_name='T1'
    select * from dba_extents where segment_name='T1'

    create table t2 tablespace test as select * from dba_object;
    select * from dba_segments where segment_name in ('T1','T2')

    itpub.net论坛管理类下发的一些帖子。
    warehouse

    8

    sqlplus sys/system@abc as sysdba(sysoper)
    select * from system_privilege_map where name in ('CREATE TABLE','SYSDBA','SYSOPER'); 查询系统权限
    show parameter o7
    把o7。。。参数改为true,sys用户就和普通用户一样不用再加as。。。
    但改了之后对数据库的安全性有隐患。

    9
    1.uninstall
    2.install
    3.dbca
    4.listener,tns
    =====================================
    5os认证和口令文件


    11
    创建表空间
    create tablespace test2 datafile 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\test3.dbf' size 5m;

    创建表
    create table t_1 tablespace test2 as select * from dba_objects;
    往t1里面放数据
    insert into t_1 select * from t_1;
    扩展数据空间
    alter database datafile 9 resize 10m;
    9为datafile的file_id.

    select * from dba_tablespace;

    select * from dba_data_files;
    自动扩展表空间
    alter database datafile 9 autoextend on;
    alter database datafile 9 autoextend on next 5m;
    alter tablespace TEST2 ADD datafile 'E:\ORACLE\PRODUCT
    \10.2.0\ORADATA\TEST4.DBF' SIZE 1M;

    select * from dba_extents where segment_name='T_1';
    手动分配extent

    alter table t_1 allocate extent(size 1m datafile '*.dbf')
    数据库脱机
    alter tablespace test2 offline;
    select count(*) from t_1;
    alter tablespace test2 online;

    可读写和只读的
    alter tablespace test2 read only;
    没法修改数据。但是可以drop。因为他访问的是数据字典中的表的语法。

    通过:select * from v$datafile查看read only的状态。v代表视图。是动态
    的。
    删除表空间
    drop tablespace test;注意:如表空间有对象就删不掉该表空间。
    drop tablespace test including contents and datafile;
    对表空间重命名
    alter tablespace test2 rename to test;
    用户管理
    1创建用户
    查看和用户相关的试图
    select * from dba_users

    create useer test1 identified by test1;
    授权:

    grant create session to test1;
    grant create table to test1;
    select * from system_privilege_map(系统权限)
    有了权限就可以建立新表了。
    0109

    create useer test2 identified by test2 default tablespace test;
    select * from database properties;

    alter database default tablespace test;

    drop tablespace users;

    alter user test1 default tablespace test;
    用户能使用表空间的大小

    create useer test3 identified by test3 default tablespace test quota 10m on test;

  • 相关阅读:
    Envoy
    Redis 使用总结
    kafka(一)
    docker搭建kafka环境&&Golang生产和消费
    docker-composer +Grafana+Prometheus系统监控之Redis
    Docker基础命令
    connection pool exhausted
    golang 单元测试&&性能测试
    golang http 中间件
    golang 函数的特殊用法
  • 原文地址:https://www.cnblogs.com/swads/p/3012897.html
Copyright © 2011-2022 走看看