顯示具有 Linux 標籤的文章。 顯示所有文章
顯示具有 Linux 標籤的文章。 顯示所有文章

2019年10月24日 星期四

Oracle DB - Creating Linux Services for DB auto-start auto-stop Oracle 19c On OEL7


創建 Linux Services - dbora
Create a new service to automatically start/stop an Oracle database. This assumes the Oracle database is not using Oracle Restart and the "start_all.sh" and "stop_all.sh" scripts are already present.

# vi /lib/systemd/system/dbora.service

[Unit]
Description=The Oracle Database Service
After=syslog.target network.target

[Service]
# systemd ignores PAM limits, so set any necessary limits in the service.
# Not really a bug, but a feature.
# https://bugzilla.redhat.com/show_bug.cgi?id=754285
LimitMEMLOCK=infinity
LimitNOFILE=65535

#Type=simple
# idle: similar to simple, the actual execution of the service binary is delayed
#       until all jobs are finished, which avoids mixing the status output with shell output of services.
RemainAfterExit=yes
User=oracle
Group=oinstall
Restart=no
ExecStart=/bin/bash -c '/home/oracle/scripts/start_all.sh'
ExecStop=/bin/bash -c '/home/oracle/scripts/stop_all.sh'

[Install]
WantedBy=multi-user.target


Reload systemd so it can see the new service.
# systemctl daemon-reload


Start the service and enable so it is automatically restarted on reboot.
# systemctl start dbora.service
# systemctl enable dbora.service
# systemctl status dbora.service

參考資訊:
Linux Services (systemd, systemctl)

2019年10月16日 星期三

Oracle DB - 修改資料庫參數 memory_max_target 重啟DB遭遇錯誤



修改資料庫參數 memory_max_target 之後重啟DB遭遇錯誤

1. ORA-00845: MEMORY_TARGET not supported on this system










SQL> ALTER SYSTEM SET memory_max_target = 1887436800 SCOPE=SPFILE;

System altered.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system

[解決方式]
從alert log 可以看到類似的警告訊息。
WARNING: You are trying to use the MEMORY_TARGET feature. This feature requires the /dev/shm file system to be mounted for at least 1996488704 bytes. /dev/shm is either not mounted or is mounted with available space less than this size. Please fix this so that MEMORY_TARGET can work as expected. Current available is 1936601088 and used is 237568 bytes. Ensure that the mount point is /dev/shm for this directory.
memory_target needs larger /dev/shm




1. vi /etc/fstab

tmpfs                   /dev/shm                tmpfs   defaults,size=96g        0 0

2. reboot os




3. startup database

2. ORA-27102: out of memory








SQL> ALTER SYSTEM SET memory_max_target ='16G' SCOPE=SPFILE;

System altered.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup
ORA-27102: out of memory
Linux-x86_64 Error: 12: Cannot allocate memory
Additional information: 26
Additional information: 327685
Additional information: 1711276032



[解決方式]
 memory_max_target 不可超過 實體記憶體 + Swap Space。

$ free
             total       used       free     shared    buffers     cached
Mem:       3782888    1674632    2108256     232144      34832     914080
-/+ buffers/cache:     725720    3057168
Swap:     10239996          0   10239996


1. 把  memory_max_target 調整到適合大小,再 startup database
2. 增加實體記憶體或swap space,,再 startup database

3. 其他注意事項








If AMM is enabled.

(Do not)勿調整SGA_MAX_SIZE

SGA_MAX_SIZE會自動調整成和MEMORY_MAX_TARGET相同值。





If AMM is disabled.

(Do not)勿調整SGA_MAX_SIZE超過 MEMORY_MAX_TARGET

SQL> startup
ORA-00843: Parameter not taking MEMORY_MAX_TARGET into account

ORA-00849: SGA_TARGET 12884901888 cannot be set to more than MEMORY_MAX_TARGET 2013265920.

2019年7月5日 星期五

Linux作業系統兩大門派: Redhat系列與Debian系列









參考資料:
https://www.itread01.com/content/1547841061.html
https://zh.wikipedia.org/wiki/Oracle_Linux


2019 年 03 月 19 日
再次易手完成,SUSE 成為全球最大獨立開源方案公司
自從紅帽被 IBM 收購之後,開源的商業模式已經證明有運行下去的可能。而 Linux 生態系中,發行 OpenSUSE Linux 發行版的 SUSE 公司,則以相反的方向,在被收購後變成獨立的開源方案公司,並且在 3 月 15 完成相關程序。

SUSE 是在去年 7 月 2 日宣布獨立被出售出去,由投資公司 EQT Partner 出價買下,價格是 25 億 3,500 萬美元。SUSE 有多次經營權易手的狀況,SUSE 的前東家是英國公司 Micro Focus,Micro Focus 則是從 HPE 手上連同 OpenStack 和 Cloud Factory,得到 HPE 非核心的軟體業務。 而在 Micro Focus 之前,2003 年 SUSE 則被 Novell 購併,Novell 則在 2011 年被 Attachment 買下,SUSE 因而成為 Attachment 一員。2014 年 Microfocus 與 Attachment 合併,SUSE 也就來到合併後的新公司。

2018-07-03
https://www.ithome.com.tw/news/124280
遭Micro Focus出售,SUSE再易主
Micro Focus以25.35億美元將SUSE賣給私募基金公司EQT,為SUSE 15年來第四次易主,EQT承諾未來會確保SUSE獨立營運。

2010/11/27
http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?viewmode=compact&topic_id=33520&forum=11
#1 Novell被收購,SUSE Linux去向受矚目
UGP 2010/11/27 20:39
Novell宣佈以22億美元賣給Attachmate,同時微軟也將因此而取得Novell價值達4.5億美金的智慧財產權(IP)。未來SUSE Linux走向成為外界的關注焦點。

2004 年 1 月 13 日
http://www.novell.com/zh-tw/news/press/archive/2004/01/pr04003.html
Novell 完成對 SUSE Linux 的併購
Novell 為 Linux 帶來企業級基礎架構,成為市場中規模最大的 Linux 廠商
Novell 的全球性技術支援將幫助企業充滿信心地部署 Linux
交易的完成提供了 IBM 向 Novell 投資五千萬美元的舞臺
猶他州 PROVO 市— 2004 年 1 月 13 日— Novell 今天完成了對 SUSE Linux 的併購,這是為 Linux 帶來全球性技術支援、諮詢和訓練服務以及業界領先的網路和安全性的一次合併,並且它將為希望充分利用開放源碼的眾多優點的公司提供引人注目的選擇方案。Novell 現在提供從伺服器到桌面的 Linux 平臺上的完整企業解決方案。這次二億一千萬美元的現金交易的終結,也開啟了完成 11 月 4 日宣佈的 IBM 向 Novell 投資五千萬美元的行動之門。












2014年9月1日 星期一

Linux - Shell scripting, Show command executed along with output in log file



1. 用echo or printf

2. 用set -x


[root@testdb4 script]# tar cf /tmp/test.tar -T /root/script/tar_from.txt
tar: Removing leading `/' from member names
[root@testdb4 script]#
[root@testdb4 script]# /root/script/test_tar2.sh
[root@testdb4 script]#
[root@testdb4 script]# cat test_tar2.sh.out
+ tar cf /tmp/test.tar -T /root/script/tar_from.txt
tar: Removing leading `/' from member names
[root@testdb4 script]#
[root@testdb4 script]# cat /root/script/test_tar2.sh
#!/bin/sh
out=$0.out
set -x
{
tar cf /tmp/test.tar -T /root/script/tar_from.txt
} >$out 2>&1



[root@testdb4 script]# cat /root/script/test_tar2.sh
#!/bin/sh
out=$0.out
#set -x
{
tar cf /tmp/test.tar -T /root/script/tar_from.txt
} >$out 2>&1
[root@testdb4 script]# /root/script/test_tar2.sh
[root@testdb4 script]# cat test_tar2.sh.out
tar: Removing leading `/' from member names

  • 2>&1 indicates that the standard error (2>) is redirected to the same file descriptor that is pointed by standard output (&1).



2014年8月21日 星期四

Linux LVM 實做 新增 遷移 刪除


//
//在rapap02新增一個Logical Volume
//掛載到 /mnt/lv011,Copy資料到其中
//卸載並且vgexport
//
[root@rapap02 ~]# fdisk -l
Disk /dev/xvda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1          13      104391   83  Linux
/dev/xvda2              14        2610    20860402+  8e  Linux LVM
Disk /dev/xvdb: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/xvdb doesn't contain a valid partition table
Disk /dev/xvdc: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/xvdc doesn't contain a valid partition table
Disk /dev/xvdd: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/xvdd doesn't contain a valid partition table
[root@rapap02 ~]# vgcreate vgtest /dev/xvdd
  No physical volume label read from /dev/xvdd
  Physical volume "/dev/xvdd" successfully created
  Volume group "vgtest" successfully created
[root@rapap02 ~]# vgdisplay vgtest
  --- Volume group ---
  VG Name               vgtest
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               2.00 GB
  PE Size               4.00 MB
  Total PE              511
  Alloc PE / Size       0 / 0
  Free  PE / Size       511 / 2.00 GB
  VG UUID               gPeHCF-q2uS-t2Ps-WBLV-aTRU-eWnS-4L8FV5
[root@rapap02 ~]# lvcreate -l +511 -nlv011 vgtest
  Logical volume "lv011" created
[root@rapap02 ~]# pvscan
  PV /dev/xvdd    VG vgtest       lvm2 [2.00 GB / 0    free]
  PV /dev/xvdc    VG VolGroup01   lvm2 [50.00 GB / 0    free]
  PV /dev/xvda2   VG VolGroup00   lvm2 [19.88 GB / 0    free]
  PV /dev/xvdb    VG VolGroup00   lvm2 [29.97 GB / 16.97 GB free]
  Total: 4 [101.84 GB] / in use: 4 [101.84 GB] / in no VG: 0 [0   ]
[root@rapap02 ~]# lvscan
  ACTIVE            '/dev/vgtest/lv011' [2.00 GB] inherit
  ACTIVE            '/dev/VolGroup01/LogVol02' [50.00 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol00' [26.91 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol01' [5.97 GB] inherit
[root@rapap02 ~]# mkfs -t ext3 /dev/vgtest/lv011
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
261632 inodes, 523264 blocks
26163 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=536870912
16 block groups
32768 blocks per group, 32768 fragments per group
16352 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@rapap02 ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      27331836   4537784  21388472  18% /
/dev/xvda1              101086     13860     82007  15% /boot
tmpfs                  4194304         0   4194304   0% /dev/shm
/dev/mapper/VolGroup01-LogVol02
                      51602044  25518644  23462168  53% /u01
[root@rapap02 ~]# ll /mnt
total 0
[root@rapap02 ~]# mkdir /mnt/lv011
[root@rapap02 ~]# mount /dev/vgtest/lv011 /mnt/lv011
[root@rapap02 ~]#
[root@rapap02 ~]#
[root@rapap02 ~]#
[root@rapap02 ~]# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      27331836   4537788  21388468  18% /
/dev/xvda1              101086     13860     82007  15% /boot
tmpfs                  4194304         0   4194304   0% /dev/shm
/dev/mapper/VolGroup01-LogVol02
                      51602044  25518644  23462168  53% /u01
/dev/mapper/vgtest-lv011
                       2060176     35880   1919644   2% /mnt/lv011
[root@rapap02 ~]# ls /etc
a2ps.cfg               desktop-profiles      ident.key                     minicom.users            protocols          skel
a2ps-site.cfg          dev.d                 idmapd.conf                   mke2fs.conf              quotagrpadmins     slrn.rc
acpi                   dhcp6c.conf           init.d                        mke4fs.conf              quotatab           smartd.conf
adjtime                dhcpd.conf            initlog.conf                  modprobe.conf            racoon             smi.conf
aide.conf              DIR_COLORS            inittab                       modprobe.conf~           rc                 smrsh
alchemist              DIR_COLORS.xterm      inputrc                       modprobe.conf.orabackup  rc0.d              smt_dhcp_ra_support.conf
aliases                dnsmasq.conf          ipmi_monitoring_sensors.conf  modprobe.d               rc1.d              snmp
aliases.db             dnsmasq.d             iproute2                      motd                     rc2.d              sound
alsa                   dumpdates             ipsec.conf                    mrtg                     rc3.d              squid
alternatives           edac                  ipsec.d                       mtab                     rc4.d              ssh
amanda                 enscript.cfg          ipsec.secrets                 mtools.conf              rc5.d              stunnel
amandates              enterprise-release    iscsi                         multipath.conf           rc6.d              subversion
amd.conf               environment           isdn                          Muttrc                   rc.d               sudoers
amd.net                esd.conf              issue                         Muttrc.local             rc.local           sysconfig
anacrontab             exports               issue.net                     netplug                  rc.sysinit         sysctl.conf
anthy-conf             fb.modes              java                          netplug.d                readahead.d        sysctl.conf.orabackup
at.deny                fcoe                  jvm                           NetworkManager           reader.conf        sysctl.ktune
audisp                 filesystems           jvm-commmon                   nscd.conf                reader.conf.d      syslog.conf
audit                  firmware              jwhois.conf                   nsswitch.conf            redhat-lsb         tcsd.conf
autofs_ldap_auth.conf  fonts                 kdump.conf                    ntp                      redhat-release     termcap
auto.master            foomatic              krb5.conf                     ntp.conf                 request-key.conf   tgt
auto.misc              fstab                 ktune.d                       odbc.ini                 resolv.conf        tux.mime.types
auto.net               gconf                 ldap.conf                     odbcinst.ini             rhgb               udev
auto.smb               gcrypt                ld.so.cache                   ofed                     rmt                updatedb.conf
avahi                  gdm                   ld.so.conf                    openldap                 rndc.key           uucp
bashrc                 ghostscript           ld.so.conf.d                  opt                      rpc                vimrc
blkid                  gnome-vfs-2.0         lftp.conf                     oraInst.loc              rpm                virc
bluetooth              gnome-vfs-mime-magic  libaudit.conf                 oratab                   rwtab              warnquota.conf
bonobo-activation      gnupg                 libibverbs.d                  pam.d                    rwtab.d            watchdog.conf
brltty                 gpm-root.conf         libuser.conf                  pam_pkcs11               samba              webalizer.conf
brltty.conf            gre.d                 localtime                     pam_smb.conf             sane.d             wgetrc
capi.conf              group                 login.defs                    pango                    sasl2              wpa_supplicant
cdrecord.conf          group-                logrotate.conf                passwd                   scim               wvdial.conf
cipe                   grub.conf             logrotate.d                   passwd-                  screenrc           X11
conman.conf            gshadow               logwatch                      pcmcia                   scrollkeeper.conf  xdg
cron.d                 gshadow-              lsb-release.d                 Pegasus                  scsi_id.config     xinetd.conf
cron.daily             gssapi_mech.conf      ltrace.conf                   php.d                    securetty          xinetd.d
cron.deny              gtk                   lvm                           php.ini                  security           xml
cron.hourly            gtk-2.0               mail                          pinforc                  selinux            yp.conf
cron.monthly           hal                   mailcap                       pki                      sensors.conf       yum
crontab                hba.conf              mail.rc                       pm                       services           yum.conf
cron.weekly            host.conf             makedev.d                     ppp                      sestatus.conf      yum.repos.d
csh.cshrc              hosts                 man.config                    prelink.cache            setroubleshoot     zlogin
csh.login              hosts.allow           maven                         prelink.conf             setuptool.d        zlogout
cups                   hosts.deny            mc                            prelink.conf.d           sgml               zprofile
dbus-1                 hp                    mcelog.conf                   printcap                 shadow             zshenv
default                httpd                 mgetty+sendfax                profile                  shadow-            zshrc
depmod.d               ibm_hosts             mime.types                    profile.d                shells
[root@rapap02 ~]# pwd
/root
[root@rapap02 ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      27331836   4537788  21388468  18% /
/dev/xvda1              101086     13860     82007  15% /boot
tmpfs                  4194304         0   4194304   0% /dev/shm
/dev/mapper/VolGroup01-LogVol02
                      51602044  25518644  23462168  53% /u01
/dev/mapper/vgtest-lv011
                       2060176     35880   1919644   2% /mnt/lv011
[root@rapap02 ~]# cd /mnt/lv011
[root@rapap02 lv011]# cp /etc/*.conf .
[root@rapap02 lv011]# mkdir dir1
[root@rapap02 lv011]# mkdir dir2 dir3
[root@rapap02 lv011]# ls
aide.conf              dir1              host.conf                     ld.so.conf      mke4fs.conf     reader.conf               sysctl.conf     yp.conf
amd.conf               dir2              idmapd.conf                   lftp.conf       modprobe.conf   request-key.conf          syslog.conf     yum.conf
autofs_ldap_auth.conf  dir3              initlog.conf                  libaudit.conf   mtools.conf     resolv.conf               tcsd.conf
brltty.conf            dnsmasq.conf      ipmi_monitoring_sensors.conf  libuser.conf    multipath.conf  scrollkeeper.conf         updatedb.conf
capi.conf              esd.conf          ipsec.conf                    logrotate.conf  nscd.conf       sensors.conf              warnquota.conf
cdrecord.conf          gpm-root.conf     jwhois.conf                   lost+found      nsswitch.conf   sestatus.conf             watchdog.conf
conman.conf            grub.conf         kdump.conf                    ltrace.conf     ntp.conf        smartd.conf               webalizer.conf
dhcp6c.conf            gssapi_mech.conf  krb5.conf                     mcelog.conf     pam_smb.conf    smi.conf                  wvdial.conf
dhcpd.conf             hba.conf          ldap.conf                     mke2fs.conf     prelink.conf    smt_dhcp_ra_support.conf  xinetd.conf
[root@rapap02 lv011]# cd
[root@rapap02 ~]# umount /dev/vgtest/lv011
[root@rapap02 ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      27331836   4537788  21388468  18% /
/dev/xvda1              101086     13860     82007  15% /boot
tmpfs                  4194304         0   4194304   0% /dev/shm
/dev/mapper/VolGroup01-LogVol02
                      51602044  25518644  23462168  53% /u01
[root@rapap02 ~]# vgchange -a n vgtest
  0 logical volume(s) in volume group "vgtest" now active
[root@rapap02 ~]# vgdisplay
  --- Volume group ---
  VG Name               vgtest
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               2.00 GB
  PE Size               4.00 MB
  Total PE              511
  Alloc PE / Size       511 / 2.00 GB
  Free  PE / Size       0 / 0
  VG UUID               gPeHCF-q2uS-t2Ps-WBLV-aTRU-eWnS-4L8FV5
  --- Volume group ---
  VG Name               VolGroup01
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               50.00 GB
  PE Size               4.00 MB
  Total PE              12799
  Alloc PE / Size       12799 / 50.00 GB
  Free  PE / Size       0 / 0
  VG UUID               N04jCd-WjJe-pUAm-apea-nAc1-7oNy-oNri2U
  --- Volume group ---
  VG Name               VolGroup00
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               49.84 GB
  PE Size               32.00 MB
  Total PE              1595
  Alloc PE / Size       1052 / 32.88 GB
  Free  PE / Size       543 / 16.97 GB
  VG UUID               q07Lbb-zGJ2-Wtze-S1MK-tDpr-6Cqu-xZs7oT
[root@rapap02 ~]# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "vgtest" using metadata type lvm2
  Found volume group "VolGroup01" using metadata type lvm2
  Found volume group "VolGroup00" using metadata type lvm2
[root@rapap02 ~]# vgexport vgtest
  Volume group "vgtest" successfully exported
[root@rapap02 ~]# vgscan
  Reading all physical volumes.  This may take a while...
  Found exported volume group "vgtest" using metadata type lvm2
  Found volume group "VolGroup01" using metadata type lvm2
  Found volume group "VolGroup00" using metadata type lvm2
[root@rapap02 ~]# vgdisplay vgtest -v
    Using volume group(s) on command line
    Finding volume group "vgtest"
  Volume group vgtest is exported
  --- Volume group ---
  VG Name               vgtest
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             exported/resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               2.00 GB
  PE Size               4.00 MB
  Total PE              511
  Alloc PE / Size       511 / 2.00 GB
  Free  PE / Size       0 / 0
  VG UUID               gPeHCF-q2uS-t2Ps-WBLV-aTRU-eWnS-4L8FV5
  Volume group vgtest is exported
  --- Physical volumes ---
  PV Name               /dev/xvdd
  PV UUID               GIfDA5-JdVQ-0VWq-bGJG-QsWA-zYPf-joXF9g
  PV Status             allocatable
  Total PE / Free PE    511 / 0
[root@rapap02 ~]# lvscan
  Volume group vgtest is exported
  ACTIVE            '/dev/VolGroup01/LogVol02' [50.00 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol00' [26.91 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol01' [5.97 GB] inherit




//
//在testdb4做vgimport vgtest
//掛載到 /mnt/lv011,檢查資料是否完整
//

[root@testdb4 etc]# cat /etc/fstab
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
[root@testdb4 dev]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      14124720   9951560   3444072  75% /
/dev/xvda1              101086     32579     63288  34% /boot
tmpfs                  1048576         0   1048576   0% /dev/shm
[root@testdb4 dev]# fdisk -l
Disk /dev/xvda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1          13      104391   83  Linux
/dev/xvda2              14        2610    20860402+  8e  Linux LVM
Disk /dev/dm-0: 14.9 GB, 14931722240 bytes
255 heads, 63 sectors/track, 1815 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/dm-0 doesn't contain a valid partition table
Disk /dev/dm-1: 6408 MB, 6408896512 bytes
255 heads, 63 sectors/track, 779 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/dm-1 doesn't contain a valid partition table
[root@testdb4 dev]# fdisk -l
Disk /dev/xvda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1          13      104391   83  Linux
/dev/xvda2              14        2610    20860402+  8e  Linux LVM
Disk /dev/dm-0: 14.9 GB, 14931722240 bytes
255 heads, 63 sectors/track, 1815 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/dm-0 doesn't contain a valid partition table
Disk /dev/dm-1: 6408 MB, 6408896512 bytes
255 heads, 63 sectors/track, 779 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/dm-1 doesn't contain a valid partition table
Disk /dev/xvdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/xvdb doesn't contain a valid partition table
You have new mail in /var/spool/mail/root

[root@testdb4 dev]# pvscan
  PV /dev/xvdb     is in exported VG vgtest [2.00 GB / 0    free]
  PV /dev/xvda2   VG VolGroup00   lvm2 [19.88 GB / 0    free]
  Total: 2 [21.87 GB] / in use: 2 [21.87 GB] / in no VG: 0 [0   ]
[root@testdb4 dev]#
[root@testdb4 dev]# vgimport vgtest
  Volume group "vgtest" successfully imported
[root@testdb4 dev]# pvscan
  PV /dev/xvdb    VG vgtest       lvm2 [2.00 GB / 0    free]
  PV /dev/xvda2   VG VolGroup00   lvm2 [19.88 GB / 0    free]
  Total: 2 [21.87 GB] / in use: 2 [21.87 GB] / in no VG: 0 [0   ]
[root@testdb4 dev]# lvscan
  inactive          '/dev/vgtest/lv011' [2.00 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol00' [13.91 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol01' [5.97 GB] inherit
[root@testdb4 dev]# vgchange -a y vgtest
  1 logical volume(s) in volume group "vgtest" now active
[root@testdb4 dev]# lvscan
  ACTIVE            '/dev/vgtest/lv011' [2.00 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol00' [13.91 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol01' [5.97 GB] inherit
[root@testdb4 dev]# mkdir /mnt/lv011
[root@testdb4 dev]# mount /dev/vgtest/lv011 /mnt/lv011
[root@testdb4 dev]# cd /mnt/lv011
[root@testdb4 lv011]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      14124720   9951632   3444000  75% /
/dev/xvda1              101086     32579     63288  34% /boot
tmpfs                  1048576         0   1048576   0% /dev/shm
/dev/mapper/vgtest-lv011
                       2060176     36336   1919188   2% /mnt/lv011
[root@testdb4 lv011]# ls
aide.conf              dir3                          ipsec.conf      ltrace.conf     prelink.conf              syslog.conf
amd.conf               dnsmasq.conf                  jwhois.conf     mcelog.conf     reader.conf               tcsd.conf
autofs_ldap_auth.conf  esd.conf                      kdump.conf      mke2fs.conf     request-key.conf          updatedb.conf
brltty.conf            gpm-root.conf                 krb5.conf       mke4fs.conf     resolv.conf               warnquota.conf
capi.conf              grub.conf                     ldap.conf       modprobe.conf   scrollkeeper.conf         watchdog.conf
cdrecord.conf          gssapi_mech.conf              ld.so.conf      mtools.conf     sensors.conf              webalizer.conf
conman.conf            hba.conf                      lftp.conf       multipath.conf  sestatus.conf             wvdial.conf
dhcp6c.conf            host.conf                     libaudit.conf   nscd.conf       smartd.conf               xinetd.conf
dhcpd.conf             idmapd.conf                   libuser.conf    nsswitch.conf   smi.conf                  yp.conf
dir1                   initlog.conf                  logrotate.conf  ntp.conf        smt_dhcp_ra_support.conf  yum.conf
dir2                   ipmi_monitoring_sensors.conf  lost+found      pam_smb.conf    sysctl.conf



//
//掛載到 /mnt/lv011
//移除LVM設定
//
[root@testdb4 lv011]# pvscan
  PV /dev/xvdb    VG vgtest          lvm2 [2.00 GB / 0    free]
  PV /dev/xvda2   VG VolGroup00      lvm2 [19.88 GB / 0    free]
  PV /dev/xvdc                       lvm2 [3.00 GB]
  Total: 3 [24.87 GB] / in use: 2 [21.87 GB] / in no VG: 1 [3.00 GB]
[root@testdb4 lv011]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      14124720   9951652   3443980  75% /
/dev/xvda1              101086     32579     63288  34% /boot
tmpfs                  1048576         0   1048576   0% /dev/shm
/dev/mapper/vgtest-lv011
                       2060176     36336   1919188   2% /mnt/lv011
[root@testdb4 lv011]# cd
[root@testdb4 ~]# umount /dev/vgtest/lv011
[root@testdb4 ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      14124720   9951652   3443980  75% /
/dev/xvda1              101086     32579     63288  34% /boot
tmpfs                  1048576         0   1048576   0% /dev/shm
[root@testdb4 ~]# pvremove /dev/xvdc
  Labels on physical volume "/dev/xvdc" successfully wiped
[root@testdb4 ~]# pvscan
  PV /dev/xvdb    VG vgtest       lvm2 [2.00 GB / 0    free]
  PV /dev/xvda2   VG VolGroup00   lvm2 [19.88 GB / 0    free]
  Total: 2 [21.87 GB] / in use: 2 [21.87 GB] / in no VG: 0 [0   ]
[root@testdb4 ~]# pvremove /dev/xvdb
  Can't pvremove physical volume "/dev/xvdb" of volume group "vgtest" without -ff
[root@testdb4 ~]# vgremove /dev/vgtest/
  Invalid volume group name: vgtest/
  Run `vgremove --help' for more information.
[root@testdb4 ~]# vgremove /dev/vgtest
Do you really want to remove volume group "vgtest" containing 1 logical volumes? [y/n]: y
Do you really want to remove active logical volume lv011? [y/n]: y
  Logical volume "lv011" successfully removed
  Volume group "vgtest" successfully removed
[root@testdb4 ~]# pvremove /dev/xvdb
  Labels on physical volume "/dev/xvdb" successfully wiped
[root@testdb4 ~]# pvscan
  PV /dev/xvda2   VG VolGroup00   lvm2 [19.88 GB / 0    free]
  Total: 1 [19.88 GB] / in use: 1 [19.88 GB] / in no VG: 0 [0   ]


2014年6月12日 星期四

Linux - ubuntu 設定 SSH 的方式




http://blog.udn.com/nigerchen/2262865



http://www.ewdna.com/2012/06/ubuntu-ssh-server.html


http://kirby86a.pixnet.net/blog/post/94998110-ubuntu-12.04%E5%AE%89%E8%A3%9Dssh

Oracle DB - Purge Oracle alert log file




HOSTNAME=`/bin/uname -n`; export HOSTNAME
WHO_AM_I=`who am i | awk '{print $1}'`; export WHO_AM_I
TODAY=`date '+%d-%b-%Y:%H:%M'`; export TODAY

cd /u01/oracle/diag/rdbms/dgtest_p/DGTEST/trace
cp ./alert_$ORACLE_SID.log ./alert_$ORACLE_SID.log.$TODAY
cat /dev/null > ./alert_$ORACLE_SID.log

or just

mv ./alert_$ORACLE_SID.log ./alert_$ORACLE_SID.log.$TODAY

2014年2月20日 星期四

ntp對時 = > date command is not work



4.6. Time handling in Linux VMs
By default, the clocks in a Linux VM are synchronized to the clock running on the control domain, and cannot be independently changed. This mode is a convenient default, since only the control domain needs to be running the NTP service to keep accurate time across all VMs. Upon installation of a new Linux VM, make sure you change the time-zone from the default UTC to your local value (see Section 4.8, “Release Notes” for specific distribution instructions).

[root]# cat /proc/sys/xen/independent_wallclock
0 => Linux VM are synchronized to the clock on VM Server.
1 => Linux VM can be set to maintain independent times.

Individual Linux VMs can be set to maintain independent times
1.From a root prompt on the VM, type the command: echo 1 > /proc/sys/xen/independent_wallclock
2.This can be persisted across reboots by changing the /etc/sysctl.conf configuration file and adding:
# Set independent wall clock time
xen.independent_wallclock=1

2014年2月5日 星期三

Ubuntu - Tips

CheckingYourUbuntuVersion
https://help.ubuntu.com/community/CheckingYourUbuntuVersion
Enter the command lsb_release -a


[ubuntu]利用vnc連線到ubuntu
http://blog.jsdan.com/ubuntu%E5%88%A9%E7%94%A8vnc%E9%80%A3%E7%B7%9A%E5%88%B0ubuntu/

[ubuntu] remote desktop
In Ubuntu Session (Dash Home –> Search For –> Desktop Sharing )
http://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/how-to-take-remote-desktop-from-windows-to-ubuntu-13-04.html#axzz2nj5uEuiE

2014年1月17日 星期五

Linux - iftop

http://sealmemory.blogspot.tw/2012/10/iftop-linux.html
http://www.ex-parrot.com/~pdw/iftop/
http://www.vpser.net/manage/iftop.html
http://sealmemory.blogspot.tw/2012/10/iftop-linux.html




--安裝
tar zxvf iftop-0.17.tar.gz
cd iftop-0.17
./configure
make
make install
or

yum  install iftop


--執行

# iftop -i eth1 -B





netstat
top

2014年1月8日 星期三

Oracle Linux Support and Oracle VM Support Global Price List





1 Year Support 1
Oracle Linux Network
119.00
System
Oracle Linux Basic Limited
499.00
System
Oracle Linux Basic
1,199.00
System
Oracle Linux Premier Limited
1,399.00
System
Oracle Linux Premier
2,299.00
System


1 Year Support Oracle VM Premier Limited 599.00 System
Oracle VM Premier 1,199.00 System



Oracle Linux Premier Limited and Oracle Linux Basic Limited support services are available only for systems with no more than 2 physical CPUs per system. Where computers are clustered, each system within the cluster must have no more than 2 physical CPUs.
Oracle Linux Premier, Oracle Linux Basic and Oracle Linux Network support services are available for
systems with any number of physical CPUs per system


Oracle VM support services are provided at the support level and for the term defined in your order. When ordering Oracle VM support services you must comply with the following availability rules:
Oracle VM Premier Limited support services are available only for systems with no more than 2 physical
CPUs per system.

2013年10月9日 星期三

Linux Server - upgrade and 指定要boot的os image file


yum:
CentOS 與 Fedora 所常用的自動升級機制,透過 FTP 或 WWW 來進行線上升級以及線上直接安裝套件;
up2date:
這是 Red Hat 所使用的自動升級機制,需要註冊才能使用,並且依據付費與否而管制其流量;

//****************************************************************************
mount -o ro,loop /source/Enterprise-R5-U5-Server-x86_64-dvd.iso /mnt

vi /etc/yum.repos.d/local.repo
[local]
name=local
baseurl=file:///mnt/Server/
enabled=1
gpgcheck=0

yum repolist

yum list update

yum update

shutdown -r now


//*****************************************************************************




Oracle Linux 5
# cd /etc/yum.repos.d
# wget https://public-yum.oracle.com/public-yum-el5.repo

# grep -B 5 enabled=1 public-yum-el5.repo

Oracle Linux 6
# cd /etc/yum.repos.d
# wget https://public-yum.oracle.com/public-yum-ol6.repo

Oracle VM 2
# cd /etc/yum.repos.d
# wget https://public-yum.oracle.com/public-yum-ovm2.repo

Enable the appropriate repository by editing the yum configuration file

Open the yum configuration file in a text editor
Locate the section in the file for the repository you plan to update from, e.g. [el4_u6_base]
Change enabled=0 to enabled=1
Begin using yum, for example:

yum repolist --to show the registered channels and you see we are including everything including the latest published RPMs.

yum list

yum install firefox



//*****************************************************************************



Reference:

1. yum upgrade - OL5_u5 to OL5_u6:
http://surachartopun.com/2011/01/yum-upgrade-ol5u5-to-ol5u6.html

2. http://husnusensoy.wordpress.com/2013/02/13/upgrade-to-oracle-enterprise-linux-5-9-andso-uek2/


Oracle Linux: Upgrade between major releases is not supported (Doc ID 821668.1)


//*****************************************************************************

Bootloader default 會找第一個 Title,可以修改 default來做指定。

[root@testdb4 grub]# pwd
/boot/grub
[root@testdb4 grub]# more grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
#          initrd /initrd-version.img
#boot=/dev/xvda
default=0   <== default會找第一個title
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Oracle Linux Server (2.6.18-274.el5xen)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-274.el5xen ro root=/dev/VolGroup00/LogVol00 rhgb quiet numa=off
        initrd /initrd-2.6.18-274.el5xen.img
title Oracle Linux Server (2.6.32-200.13.1.el5uek)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-200.13.1.el5uek ro root=/dev/VolGroup00/LogVol00 rhgb quiet numa=off
        initrd /initrd-2.6.32-200.13.1.el5uek.img
title Enterprise Linux (2.6.18-194.el5xen)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-194.el5xen ro root=/dev/VolGroup00/LogVol00 rhgb quiet numa=off
        initrd /initrd-2.6.18-194.el5xen.img

2013年6月11日 星期二

Linux Server - lvextend

df -h
pvscan
lvscan
vgdisplay VolGroup00
lvextend -l +144 /dev/VolGroup00/LogVol02
resize2fs /dev/VolGroup00/LogVol02

2013年5月9日 星期四

Linux Server - How to configure VNC server to load up the complete GNOME desktop and auto startup after server power on


[root@testdb4 ~]# chkconfig vncserver on --level 5
[root@testdb4 ~]# chkconfig --list|grep vnc
vncserver       0:off   1:off   2:off   3:off   4:off   5:on    6:off

[oracle@testdb4 .vnc]$ pwd
/home/oracle/.vnc
[oracle@testdb4 .vnc]$ cat xstartup
#!/bin/sh

# Uncomment the following two lines for normal desktop:
 unset SESSION_MANAGER
 exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
#gnome-session &

[root@testdb4 rc5.d]# more /etc/sysconfig/vncservers
# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own).  You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, see
# <URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html>.

# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.

# Use "-nohttpd" to prevent web-based VNC clients connecting.

# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel.  See the "-via" option in the
# `man vncviewer' manual page.

# VNCSERVERS="2:myusername"
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"

 VNCSERVERS="2:oracle"
 VNCSERVERARGS[2]="-geometry 1024x768 -nohttpd -nolisten tcp"

2013年1月3日 星期四

Oracle Linux - 在Linux Server上面設定網路印表機


關於在Linux Server上面設定網路印表機,可以參考鳥哥的文章。

印表機對於linux server 的支援度: http://www.openprinting.org/printers

http://linux.vbird.org/linux_basic/0610hardware.php#cups

只要你購買的印表機有支援 postscript ,那麼安裝起來應該是很輕鬆的才是。我們在上面提到的印表機支援網站中, 裡面的驅動程式很多就是 postscript 印表機描述檔案 (Postscript Printer Description)

這些列印的 PPD 驅動程式檔放在哪裡呢?其實就放在 /usr/share/cups/model/ 底下

以下透過socket, IPP, SMB三種方式來實作Linux server下的網路印表機,都可以工作的很好。

實作環境:
OS: Oracle Linux 5.5  Hostname: testdb3
Printer: Epson AL M2310  Pirnter Name:

實作步驟:
1. 在下列網址download ppd file for Epson M2310
http://www.openprinting.org/driver/eplaser

2. 在testdb3上面透過socket的方式,並搭配M2310 ppd file --> 可以成功的列印





3. 在testdb3上面透過ipp的方式,並搭配M2310 ppd file --> 可以成功的列印



4. 在testdb3上面透過samba的方式,並搭配M2310 ppd file --> 可以成功的列印


http://foo2zjs.rkkda.com/
cp -p HP-LaserJet_Pro_P1606dn.ppd /etc/cups/ppd


曾經設定過的印表機:
Epson AcuLaser M2310
HP Color LaserJet 2605dn
HP LaserJet 1606dn

2012年11月27日 星期二

JDE - Oracle HTTP Server - start using oracle account


Oracle 10g HTTP Server: Solving "[crit] (13)Permission denied: make_sock: could not bind to port 83"

There is a trick that httpd port under 1024 need to run as root initially. (e.g. port=83)
Here's the configuration steps:

1. su -

2. cd /u01/OracleAS_1/Apache/Apache/bin

3. chown root .apachectl

4. chmod 6750 .apachectl

5. ls -al .apachectl

6. su - oracle
   cd /u01/OracleAS_1/opmn/bin
   ./opmnctl stopall
   ./opmnctl startall



[root@e1oas03 init.d]# cat /etc/init.d/ias
#!/bin/sh
#
# Author : Arun Singh, Novell Inc.
#
# 1. Add root to dba and oinstall group to function this script properly
#
# 2. Create this file in /etc/init.d directory (ias) and use "chkconfig ias on"
# You can put these and other commands in a single file (startup or shutdown)
# and use as single command. This example is to make instruction clear.
# $ORACLE_HOME/dcm/bin/dcmctl startup
# $ORACLE_HOME/opmn/bin/opmnctl start
# $ORACLE_HOME/bin/emctl start iasconsole
#
### BEGIN INIT INFO
# Provides: ias
# Required-Start: $network $syslog $remote_fs raw
# Required-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start the Oracle iAS
### END INIT INFO
ORACLE_BASE=/u01
ORACLE_HOME=$ORACLE_BASE/OracleAS_1
ORA_OWNER=oracle
case "$1" in
'start')
echo -n "Satring Oracle iAS"
#su - $ORA_OWNER --command="$ORACLE_HOME/dcm/bin/dcmctl start" &
#su - $ORA_OWNER --command="$ORACLE_HOME/opmn/bin/opmnctl start" &
su - $ORA_OWNER --command="$ORACLE_BASE/JDE_HOME/bin/startAgent" &
su - $ORA_OWNER --command="$ORACLE_HOME/opmn/bin/opmnctl startall" &
#su - $ORA_OWNER --command="$ORACLE_HOME/bin/emctl start iasconsole" &
;;
'stop')
echo -n "Stopping Oracle iAS"
#su - $ORA_OWNER --command="$ORACLE_HOME/dcm/bin/dcmctl shutdown" &
su - $ORA_OWNER --command="$ORACLE_HOME/opmn/bin/opmnctl stopall" &
su - $ORA_OWNER --command="$ORACLE_BASE/JDE_HOME/bin/stopAgent" &
#su - $ORA_OWNER --command="$ORACLE_HOME/bin/emctl stop iasconsole" &
;;
'status')
echo -n "Checking for Oracle iAS"
su - $ORA_OWNER --command="$ORACLE_HOME/bin/emctl status iasconsole" &
;;
*)
echo "Usage: $0 {start|stop|status}"
exit 1
esac
#
exit
[root@e1oas03 init.d]#

cd /sbin
chkconfig --add ias
chkconfig --list|grep ias

2012年7月5日 星期四

Linux - 用top看每顆CPU的utilization



top 看每顆 CPU 使用狀況

  1. top
  2. top 進入後,按 1 --> 如果有多顆 CPU, 那最上面的 Cpu(s), 就會變 Cpu0 Cpu1 .....


持續監控某 PID 的 CPU / RAM 使用量

  • 假設 PID 是 1122
  • top -p 1122 # 或 watch "ps aux | grep 1122"

Oracle Linux - Forget, Forgot root password

Oracle Enterprise Linux forgot root password


1.Press F2 when the splash screen comes up
2.A GRUB screen will display
3.enter the letter 'e' (without single quotes)
4.Using the arrow keys, move the cursor to the line for kernel
5.enter the letter 'e' again
6.You will see a command line
7.after the last word/character append a space and the word single (single mode)
8.Hit Enter
9.Make sure the cursor is on the kernal line
10.enter the letter 'b' (this will boot)
11.System will load into single mode
12.Enter passwd
13.Enter new password two times
14.Enter exit (this will reboot)
15.Test the new root password