2018年3月30日 星期五

sql server firewall

@echo =========  SQL Server Ports  ===================
@echo Enabling SQLServer default instance port 1433
netsh firewall set portopening TCP 1433 "SQLServer"
@echo Enabling Dedicated Admin Connection port 1434
netsh firewall set portopening TCP 1434 "SQL Admin Connection"
@echo Enabling conventional SQL Server Service Broker port 4022 
netsh firewall set portopening TCP 4022 "SQL Service Broker"
@echo Enabling Transact-SQL Debugger/RPC port 135
netsh firewall set portopening TCP 135 "SQL Debugger/RPC"
@echo =========  Analysis Services Ports  ==============
@echo Enabling SSAS Default Instance port 2383
netsh firewall set portopening TCP 2383 "Analysis Services"
@echo Enabling SQL Server Browser Service port 2382
netsh firewall set portopening TCP 2382 "SQL Browser"
@echo =========  Misc Applications  ==============
@echo Enabling HTTP port 80
netsh firewall set portopening TCP 80 "HTTP"
@echo Enabling SSL port 443
netsh firewall set portopening TCP 443 "SSL"
@echo Enabling port for SQL Server Browser Service's 'Browse' Button
netsh firewall set portopening UDP 1434 "SQL Browser"
@echo Allowing multicast broadcast response on UDP (Browser Service Enumerations OK)
netsh firewall set multicastbroadcastresponse ENABLE


https://dotblogs.com.tw/rockchang/2014/04/14/144730

2018年3月9日 星期五

CentOS7 Oracle11 try 2




hostnamectl set-hostname oracle11
hostname oracle11

vim /etc/hosts
127.0.0.1   oracle11 localhost localhost.localdomain localhost4 localhost4.localdomain4

/usr/sbin/groupadd -g 501 oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/groupadd -g 503 oper

/usr/sbin/useradd -u 502 -g oinstall -G dba,oper oracle


/etc/sysctl.conf
kernel.shmmni = 4096
kernel.shmmax = 4398046511104
kernel.shmall = 1073741824
kernel.sem = 250 32000 100 128
fs.aio-max-nr = 1048576
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586


/etc/security/limits.conf
oracle   soft   nproc    131072
oracle   hard   nproc    131072
oracle   soft   nofile   131072
oracle   hard   nofile   131072
oracle   soft   core     unlimited
oracle   hard   core     unlimited
oracle   soft   memlock  50000000
oracle   hard   memlock  50000000




#oracle .bash_profile
# ORACLE_HOME 跟 ORACLE_BASE 相同的話會擋下
export TMP=/worktmp
export ORACLE_BASE=/oracle
export ORACLE_HOME=$ORACLE_BASE/11g
export ORACLE_SID=hissp1
PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
alias cdob='cd $ORACLE_BASE'
alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022


-----------------------------------------------------------
yum install binutils -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y
yum install zlib-devel -y
yum install elfutils-libelf-devel -y


yum install unzip -y
yum install telnet -y
yum install  nfs-utils.x86_64 -y
yum install xorg-x11-utils-7.5-22.el7.x86_64 -y
yum install mksh.x86_64 -y
yum install epel-release.noarch -y
yum install rlwrap.x86_64 -y
-----------------------------------------------------------
rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}(%{ARCH})\n' binutils \
elfutils-libelf \
elfutils-libelf-devel \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
make \
sysstat \
unixODBC \
unixODBC-devel
------------------------------------------------------------
  197  mkdir -p /oracle11
  199  chown oracle:oinstall /oracle11
  200  chmod 775 /oracle11

/etc/selinux/config
SELINUX=permissive

--------------------------------------------------------------
mkdir /oraInventory
chown -R oracle /oraInventory

----------------------------------------------------------------
安装oracle时报错memcpy@GLIBC_2.14未找到:

INFO: /lib64/libstdc++.so.5: undefined reference to `memcpy@GLIBC_2.14'
collect2: error: ld returned 1 exit status
INFO: make: *** [ctxhx] Error 1
INFO: End output from spawned process.
解决办法,先查看 /usr/lib64/libc.a是否存在:

ls /usr/lib64 | grep libc.a

如果查找不到先安装:glibc-static,如果有则略过此步

yum -y install glibc-static

修改oracle安装目录下 $ORACLE_HOME/ctx/lib/ins_ctx.mk
将

    ctxhx: $(CTXHXOBJ)
        $(LINK_CTXHX) $(CTXHXOBJ) $(INSO_LINK)
修改为:

    ctxhx: $(CTXHXOBJ)
        -static $(LINK_CTXHX) $(CTXHXOBJ) $(INSO_LINK) /usr/lib64/libc.a
然后点击retry通过

安装oracle时报错Error in invoking target 'agent nmhs':

Error in invoking target 'agent nmhs' of makefile '/data2/oracle/app/oracle/product/11.2.0/dbhome_1/sysman/lib/ins_emagent.mk'
解决办法:修改 $ORACLE_HOME/sysman/lib/ins_emagent.mk
将

$(MK_EMAGENT_NMECTL)

修改为

$(MK_EMAGENT_NMECTL) -lnnz11

然后点击retry通过

https://www.jianshu.com/p/2fda26a7edf1
----------------------------------------------------------------
/oraInventory/orainstRoot.sh
/oracle/11g/root.sh
---------------------------------------------------------------
vim /oracle/11203/sysman/lib/ins_emagent.mk
---------------------------------------------------------------
/oracle/11203/root.sh
--------------------------------------------------------------


2018年1月9日 星期二

samba4

http://technote.aven-network.com/600/samba-4-%E5%95%9F%E7%94%A8%E5%8C%BF%E5%90%8D%E5%AD%98%E5%8F%96
https://www.phpini.com/linux/centos-7-install-samba
http://playubuntu.blogspot.tw/2013/04/samba40share.html

[global]
security = user
map to guest = Bad User
guest ok = Yes
guest account = XXX


# yum install samba samba-client samba-common -y
# mv /etc/samba/smb.conf /etc/samba/smb.conf.bak


設定 /etc/samba/smb.conf
[global]
        workgroup = IntraGroup
        server string = Samba Server %v
        netbios name = pubshare
        security = user
        map to guest = bad user
        dns proxy = no
[World_Share]
        path = /MDDATA/public/intra_share
        browsable =yes
        writable = yes
        guest ok = yes
        read only = no
        create mask = 0777
        directory mask = 0777

設定目錄權限

root # mkdir -p /MDDATA/public/intra_share
root # chown nobody.nobody /MDDATA/public/intra_share
root # chmod 700 /MDDATA/public/intra_share

啟用相關服務
3
4
root # systemctl enable smb.service
root # systemctl enable nmb.service
root # systemctl start smb.service
root # systemctl start nmb.service

----------------------------------
[global]
workgroup = workgroup
security = user
        netbios name = ntp
passdb backend = tdbsam
map to guest = bad user
dns proxy = no
guest account = guest

[share]
path = /share
browsable = yes
writable = yes
guest ok = yes
readonly = no
create mask = 0777
directory mask = 0777

---------------------------------
setenforce off

https://www.tecmint.com/setup-samba-file-sharing-for-linux-windows-clients/

# setsebool -P samba_export_all_ro=1 samba_export_all_rw=1
# getsebool –a | grep samba_export
# semanage fcontext –at samba_share_t "/finance(/.*)?"
# restorecon /finance
http://n.sfs.tw/content/index/11039
yum install semanage
No package semanage available.
Error: Nothing to do
OK,顯然找不到,這時使用yum 的option "provides"
# yum provides semanage
# yum install policycoreutils-python

---------------------------------
# firewall-cmd --add-service=samba --permanent
# firewall-cmd --reload









ANT and Tomcat

http://www.avajava.com/tutorials/lessons/how-do-i-deploy-to-tomcat-using-ant.html

https://www.safaribooksonline.com/library/view/java-servlet/0596005725/ch04s08.html

https://tomcat.apache.org/tomcat-8.5-doc/manager-howto.html#Executing_Manager_Commands_With_Ant

2018年1月8日 星期一

ubuntu 改時區



Ubuntu 要改變 Timezone 時區設定,可以用以下方法:
dpkg-reconfigure
用 root 身份用 dpkg-reconfigure 設定 Ubuntu 的 Timezone, 好處是有一個選單可以選擇地區,不用記著時區的字串:
# dpkg-reconfigure tzdata
出現 “Configuring tzdata” 後,先選擇地區,亞洲地區選擇 “Asia”, 然後再選擇所在城市,按 “OK” 後便完成,同時系統會印出新的 Timezone 時區設定。
timedatectl
另一個方法是用 timedatectl,使用前先用以下指令取得 Timezone 列表:

# timedatectl list-timezones
但 Timezone 列表十分長, 用 grep 過濾會較方便, 以下只會印出亞洲區的時區:
# timedatectl list-timezones | grep Asia
找到要設定的時區後, 便可以設定:
香港時區:
# timedatectl set-timezone Asia/Hong_Kong
台北時區:
# timedatectl set-timezone Asia/Taipei
設定好後, 可以用 timedatectl 指令檢查時區是否設定正確:
# timedatectl