zoukankan      html  css  js  c++  java
  • SAP sybase培训笔记2

    1、考虑数据规划,存储空间有多少等等。
        按照公式估算;
        字符集、排序、页面大小创建后不能更改。
    数据存储空间规划,特别是集群模式的部署
        LUN Plan要点。
        IQ使用的磁盘,物理上必须要与其它应用隔离;
        RAID 5/6
        不要用LVM
        尽量分散I/O
    1、建议先打补丁再建库。
    2、准备文件系统
        建议给数据库日志信息(serverlog/iqmsg)等分配一个独立的文件系统,避免日志撑爆。
     start_iq -n iqdemo iqdemo.db ... <other options> ... -iqmsgsz 100 -iqmsgnum 3
    start_iq -n iqdemo iqdemo.db ... <other options> ... -iqmsgsz 100
    -iqmsgnum value n greater than 0 means that the server maintains n message log archives. For example, this command specifies that the server maintain 3 archives of the message log

              Use the -iqmsgsz and -iqmsgnum switches to prevent the message log file from growing indefinitely

    -iqmsgsz (MB)
    0 = default, which means there is no limit on the size of the message log file.
    0 < x <= 2047, Limit on the size of the message log file.


    -iqmsgnum
    0 = default, which means that messages are wrapped in the main message log file and there is no archiving
    0 < x <= 64 , sets the number of message log archives






    3、准备裸设备(可选,集群必选)
            linux下,dev/raw/rawXXX
            集群下所有节点必须能访问共享的裸设备。
     
    >start_iq -n utility_db -n utility_db  【-gp 8192】
    >dbisql -c "uid=dba;pwd=sql;eng=utility_db;dbn=utility_db" -nogui
    create database 'f: emp est.db' --一定要全路径
        IQ PATH 'f: empiq_system_main.iq'--软链接  
        IQ SIZE 100
        IQ PAGE SIZE 131072
        TEMPORARY PATH 'XXX.iqtmp'--软链接
        TEMPORARY size 200
        MESSAGE PATH 'xxx.iqmsg'---可修改
    LOG ON 'F:TEST.LOG'---可修
    page size 8192
    collation 'EUC_CHINA' ---字符集 或cp936
    BLANK PADDING ON
    CASE IGNORE;
    建服务:
    >dbisql -c "uid=dba;pwd=sql;eng=utility_db;dbn=utility_db" -nogui
    >H:sybase>CREATE DATABASE 'h:SYBASET1 1.db' LOG ON 'h:SYBASET1' PAGE SIZE 4096 IQ PATH 'SYSTEM.IQ' IQ SIZE 100 IQ PAGE SIZE 4096 TEMPORARY PATH 'h:SYBASET1 1.iqtmp' TEMPORARY size 200 MESSAGE PATH 'h:SYBASET1 1.iqmsg' collation 'EUC_CHINA' BLANK PADDING ON CASE IGNORE
    >start_iq t2.db
    参数:
    iq page size :iq store 的大小。
    缺省 128k
    可选64 18 256 512 
    共享内存:
        本地管理用:dbisql -c 'uid=dba ;pwd=sql;eng=t2'
    dbisql -c 'uid=dba ;pwd=sql;commlinks=tcpip{host=localhost:26}'    
    TCP/IP协议。
    dbisqlc -c ',,eng=eptgdev2_iqdemo' -q load.sql   ----------------------------
    dbisql -c "" -host -port -nogui 
    JDBC
    jar包
    dbisql一般是管理应用
    整个数据库大小和cpu来配置
    一个核对应8G内存,设备大小和个数根据数据量和cpu来配置。设备核数/10+3  如:8个核 8/10+3 .=4个设备
    生产环境iq_system_main是user_dbspace的20%。
    建空间:
    (DBA)> create dbspace user_ds using file ds_f1 'us1.iq' size 100
    Execution time: 0.273 seconds
    (DBA)> alter dbspace user_ds add file ds_f2 'us2.iq' size 100
    Execution time: 0.158 seconds
    (DBA)> alter dbspace user_ds add file ds_f3 'us3.iq' size 100
    Execution time: 0.192 seconds
    迁移数据。删除数据库空间。
    >alter dbspace IQ_SYSTEM_TEMP add file ds_temp 'h:sybase 1db_temp.iq' size 200;
    >create table t1(f_id int,f_value char(200) ) in user_ds;
    >insert into t1 values(1,'xx');
    >insert into t1 values(2,'yy');
    >commit
    >alter DBSPACE  user_ds alter file ds_f3 readonly;
    >sp_iqemptyfile 'ds_f3';
    >alter dbspace user_ds drop file ds_f3;
    >select * from t1
    设置服务器参数:
    可以将demo库里边script文件夹下的default.cfg拷贝demo库中,重命名为params.cfg。内容如下
    ===============================================================================================
    -n t2
    -x tcpip{port=2688}
    -ch .db文件的4-8倍
    -cl 。尽量与.db的大小一致
    -c  128m  --点击率(catlog的高速缓存,生产系统一般128M,。尽量与.db的大小一致)
    -gc 60   
    -gd all  --权限,关闭加载数据等
    -gl all
    -gm 30
    -gp 4096 --catlog page size
    -ti 4400
    -iqmc 500 --数据的高速缓存
    -iqtc 500    --临时数据的高速缓存 越大越好
    -iqlm 500  --16之后才有,基于行式存储的内存库。
    -iqmsgsz 100
    -iqmsgnum 3
    -o H:\sybase\t1\t2.svrlog
    ================================================================================================
    >start_iq @params.cfg
    加数据库用户两种方式:
    grant connect to u1 identified by '123456';
    sp_iqaddlogin 'u2','sap123456';----注意字母加数字
    组与用户的一系列操作
    grant connect to marketing;
    。。。
    grant execute on sp_iqlocks to u1
    设置存储过程执行权限。
    revoke
    iq 非链式的,open client连接,不需要显式commit。 DML还是要提交:insert/ delete等等,还是要commit。
    IQ:OLAP;
    业务系统不建议IQ.
    读不影响写,写不影响读。
    备份恢复:
    full
    incremental
    incremental-since-full
    backup database to '/dev/rmt/0n'
    backup database
    incremental to 
    sp_iqcheckdb 'allocation database';--检查数据库,数据碎片等。备份之前会做此检查,避免积累导致致命错误。
    虚拟备份:
    NonStopIQ: Sybase IQ的容灾方法:
        利用磁盘阵列的硬件特性,和sybase IQ的软件特质提供快速备份恢复。




  • 相关阅读:
    socket http tcp udp ip 协议
    docker启动报错iptables failed: -重建docker0网络恢复
    python3处理json数据
    nginx添加认证
    安装nginx和nginx-gridfs和mongodb
    Centos7下CPU内存等资源监控
    linux 中 iptables关于ping的问题
    python3和pip3安装和问题解决
    Centos7下安装zabbix 3.0.19
    ansible学习网站
  • 原文地址:https://www.cnblogs.com/iathena/p/be8557d5cf920b7fd49506481bb9bb11.html
Copyright © 2011-2022 走看看