2014年2月5日

TSM SQL ERROR (突然跑報表的SQL異常,適用TSM 5.x版本)

SQL指令正常,但是無法執行
tsm: TSM3>select node_name,type,sum(cast(logical_mb/1024 as decimal(10,2))) as Data_In_GB, sum(num_files) as Num_of_files from occupancy group by Node_name,type order by node_name
ANR2958E SQL temporary table storage has been exhausted.

         |
         V..............................................................
         select node_name,type,sum(cast(logical_mb/1024 as decimal(10,2)

ANS8001I Return code 26.

檢查help錯誤訊息,發現DB可能不足
tsm: TSM3>help 2958
-------------------------------------------------------------------------------
ANR2958E SQL temporary table storage has been exhausted.
Explanation: The result of an SQL query could not be computed because temporary
table storage space was unavailable. By issuing the QUERY DB command and viewing
the Maximum Reduction parameter, you can determine the amount of space that is
available for temporary table storage space. If the parameter is less than 4,
the storage space becomes exhausted and the SQL query can no longer run. Complex
SQL queries such as the ORDER BY clause, the GROUP BY clause, and the DISTINCT
operator can cause additional temporary table space to be required.
System Action: The SQL query is terminated.
User Response: If your database is full, increase the size of the database. If
your database is fragmented (Where the Available space parameter is greater than
4, but the Maximum Reduction parameter is less than 4), you must either unload
and load your database or add avolume.

果然DB滿了,這是5版的通病,一直要檢查
tsm: TSM3>q db

Available     Assigned       Maximum       Maximum        Page         Total          Used       Pct      Max.
    Space     Capacity     Extension     Reduction        Size        Usable         Pages      Util       Pct
     (MB)         (MB)          (MB)          (MB)     (bytes)         Pages                              Util
---------     --------     ---------     ---------     -------     ---------     ---------     -----     -----
   20,480       10,240        10,240             0       4,096     2,621,440     2,618,403      99.9     100.0

下help看如何擴充db
tsm: TSM3>help extend db
EXTEND DB
EXTEND DB (Increase the Assigned Capacity of the Database)
Use this command to increase the space that can be used by the database in all
allocated database volumes.
Attention: You cannot change the size of an allocated database volume after it
has been defined to Tivoli Storage Manager. If you do, Tivoli Storage Manager
may not initialize correctly and data could be lost.
You can issue the EXTEND DB command while users are accessing the server. Use
the QUERY DB command to determine how much you can increase the assigned
capacity of the database.
Privilege Class
To issue this command, you must have system privilege or unrestricted storage
privilege.
Syntax
>>-EXTend DB--megabytes----------------------------------------><


Parameters
  megabytes (Required)
  Specifies the space, in megabytes, to be added to the assigned capacity of the
  database. The value should be in increments of 4MB. If you do not specify the
  extension in 4MB increments, Tivoli Storage Manager rounds the number to the
  next 4MB partition.
Examples
Task
Extend the assigned capacity of the database by 52MB.
  Command
  extend db 52
Related Commands

Table 154. Commands Related to EXTEND DB
      Command Description
      CANCEL PROCESS Cancels a background server process.
      DEFINE DBCOPY Creates a volume copy of a database volume.
      DEFINE DBVOLUME Assigns a volume to be used for database storage.
      QUERY DB Displays allocation information about the database.
      QUERY PROCESS Displays information about background processes.
      REDUCE DB Attempts to free up a database volume by reducing usable storage
      within the volumes defined.

當時有預留,再擴充5GB
tsm: TSM3>ext db 5120
ANR2248I Database assigned capacity has been extended.

解決
tsm: TSM3>q db

Available     Assigned       Maximum       Maximum        Page         Total          Used       Pct      Max.
    Space     Capacity     Extension     Reduction        Size        Usable         Pages      Util       Pct
     (MB)         (MB)          (MB)          (MB)     (bytes)         Pages                              Util
---------     --------     ---------     ---------     -------     ---------     ---------     -----     -----
   20,480       15,360         5,120         5,120       4,096     3,932,160     2,619,105      66.6      66.7

指令正常了
tsm: TSM3>select node_name,type,sum(cast(logical_mb/1024 as decimal(10,2))) as Data_In_GB, sum(num_files) as Num_of_files from occupancy group by Node_name,type order by node_name

NODE_NAME                                                            TYPE                                            DATA_IN_GB     NUM_OF_FILES
----------------------------------------------------------------     --------------------     ---------------------------------     ------------
DELL305                                                              Arch                                                110.06           345062
DELL305                                                              Bkup                                                500.84          1095888
DHCP022                                                              Bkup                                                 79.27           294214
DHCP152                                                              Bkup                                                123.52           144579


tsm: TSM3>q db

Available     Assigned       Maximum       Maximum        Page         Total          Used       Pct      Max.
    Space     Capacity     Extension     Reduction        Size        Usable         Pages      Util       Pct
     (MB)         (MB)          (MB)          (MB)     (bytes)         Pages                              Util
---------     --------     ---------     ---------     -------     ---------     ---------     -----     -----
   20,480       15,360         5,120         5,120       4,096     3,932,160     2,619,104      66.6      66.7

tsm: TSM3>q dbv

Volume Name          Copy       Volume Name          Copy       Volume Name          Copy
(Copy 1)             Status     (Copy 2)             Status     (Copy 3)             Status
----------------     ------     ----------------     ------     ----------------     ------
/TSMpool1/DB.10-     Sync'd                          Undef-                          Undef-
 G.1                                                  ined                            ined
/TSMpool1/DB.10-     Sync'd                          Undef-                          Undef-
 G.2                                                  ined                            ined

tsm: TSM3>q logv

Volume Name          Copy       Volume Name          Copy       Volume Name          Copy
(Copy 1)             Status     (Copy 2)             Status     (Copy 3)             Status
----------------     ------     ----------------     ------     ----------------     ------
/TSMpool1/LOG.2-     Sync'd                          Undef-                          Undef-
 G.3                                                  ined                            ined
/TSMpool1/LOG.2-     Sync'd                          Undef-                          Undef-
 G.1                                                  ined                            ined
/TSMpool1/LOG.2-     Sync'd                          Undef-                          Undef-
 G.2                                                  ined                            ined

tsm: TSM3>q log

Available     Assigned       Maximum       Maximum        Page         Total          Used       Pct      Max.
    Space     Capacity     Extension     Reduction        Size        Usable         Pages      Util       Pct
     (MB)         (MB)          (MB)          (MB)     (bytes)         Pages                              Util
---------     --------     ---------     ---------     -------     ---------     ---------     -----     -----
    6,144        3,072         3,072         3,068       4,096       785,920           285       0.0       0.1




tsm: TSM3>

2013年12月13日

建Gateway


If you’re trying to set up a home network, you probably want to set up a permiter facing computer connected to your DSL/Cable modem, and then put all of your computers behind that firewall box to keep them safe. This tutorial will show you how to use a single external connection on the gateway computer (using Iptables firewall), and a second internal connection on the same box so you can connect the computers on the inside of your home/office to it, and automatically give them IP’s when you hook them up (using DHCP server). Iptables can be very complicated, we will only configure a basic firewall, you can add more security later without breaking things. In Linux there are many ways to do this, this one is hopefully simple enough and will teach you the basics. I did this on a CentOS 6 box, though it would work on Debian variants with only slight modifications. During this tutorial I’m logged in as root, which you should generally NOT do, but it makes the tutorial simpler, but if you prefer to do it more securely, add “sudo” before each command and it will work.
The computers on the inside of your office will also be able to talk to each other, so you can hook up printers, computers and share network connections through the switch as well. You can also set up things on your Gateway server box later like a network backup drive for all your computers using Samba relatively simply. There’s a lot of expandability in this setup, but we’ll keep it simple for now.
The first thing to do on your Gateway server is configure and enable Iptables, the default firewall that comes with CentOS. We will tell it to allow outbound traffic from your eth1 interface to the internet. You have to add an Iptables entry, save it and restart Iptables.
Step 1. Add 2 Network cards to the Linux box
Step 2. Verify the Network cards, check if they installed properly or not
Step 3. Configure eth0 for Internet with a Public (External network or Internet)
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:0c:29:d2:c2:75
IPADDR=192.168.1.10
BROADCAST=192.168.1.255
NETMASK=255.255.255.0
NETWORK=192.168.1.0
GATEWAY=192.168.1.1
DNS1=8.8.8.8
DNS2=8.8.4.4
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
Step 4. Configure eth1 for LAN with a Private IP (Internal private network)
# vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=static
HWADDR=00:0c:29:d2:c2:7f
IPADDR=192.168.10.1
BROADCAST=192.168.10.255
NETMASK=255.255.255.0
NETWORK=192.168.10.0
GATEWAY=192.168.1.10       # Enter Ip of eth0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
If you get error can’t bringing up interface eth1, and type:
# service NetworkManager stop
# chkconfig NetworkManager off
# service network start
# chkconfig network on
Step 5. Host Configuration (Optional)
# vi /etc/hosts
 
127.0.0.1 nat localhost.localdomain localhost
Step 6. Gateway Configuration
# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=nat
GATEWAY=192.168.1.1  # Internet Gateway, provided by the ISP
Step 7. DNS Configuration
# vi /etc/resolv.conf
nameserver 8.8.8.8 # Primary DNS Server provided by the ISP
nameserver 8.8.4.4 # Secondary DNS Server provided by the ISP
Step 8. Configure DHCP server to give out the IP’s to the computers on the inside of the LAN
We do that by installing the DHCP server like this:
# yum install dhcp
# vi /etc/dhcp/dhcpd.conf
option domain-name    "vjetnamnet.com";
option domain-name-servers 8.8.8.8, 8.8.4.4;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
authoritative;
subnet 192.168.10.0 netmask 255.255.255.0 {
  range dynamic-bootp 192.168.10.10 192.168.10.20;
  option broadcast-address 192.168.10.255;
  option routers 192.168.10.1;
}
Step 9. NAT configuration with IP Tables
First of all you have to flush and delete existing firewall rules. So flush rules by typing in terminal:
# iptables -F
 
# iptables -t nat -F
 
# iptables -t mangle -F
Now delete these chains:
# iptables -X
 
# iptables -t nat -X
 
# iptables -t mangle -X
Set up IP FORWARDing and Masquerading
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
 
# iptables -A FORWARD -i eth1 -j ACCEPT
Enables packet forwarding by kernel (save this setting in /etc/sysctl.conf file)
# echo 1 > /proc/sys/net/ipv4/ip_forward
and edit to make the change permanent
# vi /etc/sysctl.conf
 
net.ipv4.ip_forward=1
Apply the configuration
# service iptables save
 
# service iptables restart
Check if iptables is set to start during boot up
# chkconfig --list iptables
Step 10. Testing
Ping the Gateway of the network from client system:
# ping 192.168.10.1
Try it on your client systems:
# ping google.com
Configuring PCs on the network (Clients)
All PC’s on the private office network should set their “gateway” to be the local private network IP address of the Linux gateway computer.
The DNS should be set to that of the ISP on the internet.