发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

目前评论:10   其中:访客  10   博主  0

    • ag

      启动SAP:
      find / -name sapstartsu bwqadm
      cd /usr/sap/BWQ/ASCS03/exe
      ./sapstart r3

      • ag

        HANA这些目录的权限必须是这样设置,否则会无法启动:
        chmod 755 /hana/*
        chown -R hbqadm:sapsys log/HBQ
        chown -R hbdadm:sapsys shared/HBD
        chown -R hbdadm:sapsys data/HBD

        • ag

          总体来说 并不复杂,只需要确定一点:先备份、再删除关键文件、勇于尝试。
          command not found的情况:
          1.使用命令的绝对路径;
          2.使用./HDB的形式运行命令。

          • ag

            Each log volume contains the file logsegment_directory.dat and one or more log segment files (logsegment__.dat). Currently only one log partition is supported for each service, so the default file names are logsegment_000_directory.dat and logsegment_000_00000000.dat, logsegment_000_00000001.dat, logsegment_000_00000002.dat and so on. Log segment files are cyclically overwritten depending on the log mode. The log mode determines how logs are backed up. Log volumes only grow if there are no more segment files available for overwriting. Log segment files that are available for overwriting have been backed up and are not required for a database restart. If necessary you can remove these files to free up space in your file system by executing the SQL statement ALTER SYSTEM RECLAIM LOG. Note that new log segment files will need to be created later and this will affect performance.

            上述是HANA DB administration guide中的话。(log mode默认是normal)

            修改log mode,清空之前的log segment语句如下:
            Start the database (HDB start) and set the log_mode to ‘overwrite’ using the following SQL-Statement:
            ALTER SYSTEM ALTER CONFIGURATION (‘global.ini’, ‘SYSTEM’) SET (‘persistence’, ‘log_mode’) = ‘overwrite’ WITH RECONFIGURE;
            Restart the database (HDB restart) and use the following SQL-Statement to clean up the log volume:
            ALTER SYSTEM RECLAIM LOG;
            Set back the log_mode to ‘normal’ (you should consider switching to log_mode = normal; see note 1645183 for more information): ALTER SYSTEM ALTER CONFIGURATION (‘global.ini’, ‘SYSTEM’) SET (‘persistence’, ‘log_mode’) = ‘normal’ WITH RECONFIGURE;
            – See more at: http://www.saptechies.org/log-volume-full-log-mode-legacy-database-doesnt-accept-an/#sthash.bpAUNXBq.dpuf

            然后查询视图,SYS.M_LOG_SEGMENTS,可以将不用的log segments文件移除,腾出空间。(期间旧的log segments状态由Truncated变为Free)

            SELECT * FROM SYS.M_LOG_SEGMENTS ORDER BY SEGMENT_ID;
            其中log segments的state字段,包含值意义如下:
            Formatting – The log segment is being formatted and not yet used.
            Preallocated – The log segment has been preallocated, but never used.
            Writing – The log segment is currently being written.
            Closed – The log segment is closed, not backed up and is still required for restart.
            Truncated – The log segment is not required for restart, but has not been backed up.
            BackedUp – The log segment has been backed up, but is still required for restart.
            Free – The log segment has been backed up, it is not required for restart and can be reused.

            详细请看链接:http://help.sap.com/hana/html/_m__l_o_g__s_e_g_m_e_n_t_s.html

            1. 以上操作,可以类比下MSSQL(将recovery model由FULL,改为SIMPLE,然后shrink log文件,再改回FULL)或者ORACLE(disable archive log,清掉以前的log,再开启)
            2. 也可以不使用ALTER SYSTEM语句修改log mode,使用修改配置文件global.ini
            3. 假如重启HDB无法启动,可能产生core文件,导致/usr/sap(SPS05)和/hana/shared(SPS07)文件系统无空间,直接删掉core文件
            4. 节省空间,可以保持overwrite模式使用
            5. 任何操作之前,先做好数据备份

            • ag

              注意:
              操作HANA数据库一定要用hana用户、不要用linux系统用户;
              操作SAP服务一定要用SAP用户、不要用linux root用户,因为启动过程中会调用sapadm下的一些文件、使用root用户会报各种错误;

              • ag

                目录权限:
                chmod 777 /templog
                chown -R hbdadm /templog

                • ag

                  find / -name HDB
                  /hana/shared/HBD/HDB00/HDB stop
                  find / -name mnt00001
                  cd /hana/log/HBD/mnt00001
                  du -sh ./*
                  df -h
                  找一个空间比较大的盘,创建一个临时文件夹,例如:
                  mkdir -p /templog
                  cp -rf hdb00003 /templog/
                  ll /templog/
                  rm -rf ./hdb00003
                  cd ..
                  ln -s /templog/hdb00003 /hana/log/HBD/mnt00001/hdb00003
                  /hana/shared/HBD/HDB00/HDB start
                  然后用hana studio链接数据库,执行下面的SQL:
                  ALTER SYSTEM RECLAIM LOG;
                  然后停止数据库
                  /hana/shared/HBD/HDB00/HDB stop
                  移除软连接
                  rm -f /hana/log/HBD/mnt00001/hdb00003
                  cp -rf /templog/hdb00003 /hana/log/HBD/mnt00001ll /hana/log/HBD/mnt00001
                  rm -rf /templog/hdb00003
                  /hana/shared/HBD/HDB00/HDB start

                  此外,可以使用hana studio登录数据库后清理掉一些比较早的备份文件和备份日志,这样能节省很多空间。

                  • ag

                    HDB stop提示command not found。 可能是环境变量没有配置。
                    用root执行source /etc/profile之后再su到hana管理员运行HDB stop命令,如果还是命令不存在,则切换到root用户搜索HDB命令的文件究竟在哪。
                    find / -name HDB
                    然后执行绝对路径的命令和参数即可:
                    /hana/shared/HBD/HDB00/HDB stop

                    • ag

                      su hdbadm提示用户不存在,可能是创建的用户名不是这个,cat /etc/passwd看一下。

                      • ag

                        具体的操作:https://launchpad.support.sap.com/#/notes/0001679938