Command Line Tool
This chapter describes how to use TASCMD, a command line tool, to query and manage files stored in a disk space.
Overview
TASCMD commands can be used to query disk spaces and query and manage files stored in a disk space. It can also be used to save a file from a local directory to a disk space and vice versa.
When a TASCMD command is executed, TASCMD accesses the TAS instance and requests necessary data or jobs.
TASCMD Execution
When executing TASCMD, specify connection information for the target TAS instance as follows:
[Example 1] TASCMD Execution Parameters
tbascmd (-p) {port}
tbascmd (-p) {port} -c "{cmd}"
$ tbascmd 52000
ASCMD 7
TmaxData Corporation Copyright (c) 2008-. All rights reserved.
ASCMD>
TASCMD connects to the local TAS instance through an entered port number. The port number must be entered, and the TAS instance must booted before executing TAS and its command.
TASCMD Commands
The following describes each TASCMD command.
cd
Changes the current path.
du
Displays the total disk space occupied by the files and directories in the
specified path, or the total capacity of the disk spaces.
exit
Terminates TBASCMD.
help
Displays help about TBASCMD commands.
ls
Displays the list of files and directories in the specified path, or disk spaces.
lsds
Displays the detailed list of disk spaces.
pwd
Displays the current path.
rm
Removes TAS files.
cp
Creates a new TAS file by copying a TAS file.
cpfromlocal
Creates a new TAS file by copying a local file.
cptolocal
Creates a local file by copying a TAS file.
mkdir
Creates a directory.
mv
Moves a TAS file.
check
Checks compatibility of TAS files.
A file name or path option can be specified as absolute or relative path.
Absolute path
Starts with the '+' symbol followed by the disk space name and path in the disk space.
[Example 2] Absolute Path
current path = +DS0
ASCMD> cd +DS0/d1/sample
current path = +DS0/d1/sample
Relative path
Path relative to the current path. It is combined with the current path for use in a command.
[Example 3] Relative Path
current path = +DS0
ASCMD> cd d1/sample
current path = +DS0/d1/sample
The following symbols can be used in a relative path.
"."
Current path.
".."
Parent path. If the last '/' in a path or the current path is a disk space, this indicates the top-level path ('+').
Additional path can be appended after a "." or "..".
[Example 4] Relative Path Symbol Example
current path = +DS0/d1
ASCMD> cd ./sample
current path = +DS0/d1/sample
ASCMD> cd ../example
current path = +DS0/d1/example
cd
Changes the current path.
Usage
cd {path}
path
Path to which the current path is changed, if it exists.
du
Displays the total disk space occupied by the files and directories in the specified path, or the total capacity of the disk spaces. If the top-level path (+) is specified, the total and free sizes of disk spaces are displayed.
Usage
du [-a] [path]
-a
Displays the disk space occupied by all files of the subdirectories in the specified
path.
path
Path (optional). If not specified, the current path is used.
Example
The following example displays the size of files and their size adjusted for mirroring.
current path = +DS0/d0 ASCMD> du
File_name Used_mb Mirror used mb
f5.txt 12 24
f6.txt 2 4
f8.txt 9 18
Total mb 23 46
The following example displays the total and free sizes of disk spaces.
current path = +
ASCMD> du
diskspace name Total_mb Free_mb
DS0 3069 286
diskspace name Total_mb Free_mb
DS1 3069 2782
diskspace name Total_mb Free_mb
DS2 3069 2720
exit
Terminates TASCMD.
Usage
exit
help
Displays help about TASCMD commands. If a command is not specified, help is displayed for all commands.
Usage
help
ls
Displays the list of files and directories in the specified path, or disk spaces. If the top-level path (+) is specified, a disk space list is displayed.
Usage
ls [-a] [-s] [-l] [path]
-a
Displays the list of all files of the subdirectories in the specified path.
-s, --size
Displays the file size as well as the specified path.
-l, --long
Displays the file information as well as the specified path.
path
Path (optional). If not specified, the current path is used.
Example
The following example displays a list of files.
current path = +DS0/d0
ASCMD> ls
File_name
f5.txt
f6.txt
f8.txt
The following example displays a list of disk spaces.
current path = +
ASCMD> ls
DS0
DS1
DS2
lsds
Displays the detailed list of disk spaces. The information includes the disk space number, name, and status, redundancy level, sector size, meta block size, size allocated on disk, total size, and free size.
Usage
lsds
Example
ASCMD> lsds
===============================================================
Diskspace no. Diskspace name
0 DS0
Status Redun_type
MOUNT NORMAL
Sector_size Meta_blksize au_size
512 8192 1048576
Total_mb Free_mb
3069 286
===============================================================
Diskspace no. Diskspace name
1 DS1
Status Redun_type
MOUNT NORMAL
Sector_size Meta_blksize au_size
512 8192 1048576
Total_mb Free_mb
3069 2782
===============================================================
...
pwd
Displays the current path.
Usage
pwd
Example
ASCMD> pwd
current path: +DS0/d0
rm
Removes TAS files.
Usage
rm [-f] [-r] [-v] {files}
-f, --force
Ignores non-existent files and does not display an error message.
-r, --recursive
Removes a directory.
-v, --verbose
Displays the processing results.
files
Path and name of file(s) to remove. One or more files can be specified.
Example
current path = +DS0/d0
ASCMD> ls
File_name
f5.txt
f6.txt
f8.txt
ASCMD> rm f5.txt
rm complete: +DS0/d0/f5.txt
ASCMD> ls
File_name1
f6.txt
f8.txt
When the rm command is executed while the database is running, errors occur to all files except for the .arc file.
ASCMD> rm c1.ctl
ERROR: no such path '+DS0/c1.ctl'
ERROR: rm terminated with error: Invalid argument
ASCMD> rm test001.dtf
ERROR: no such path '+DS0/test001.dtf'
ERROR: rm terminated with error: Invalid argument
ASCMD> rm +DS0/.passwd
ERROR: no such path '+DS0/.passwd'
ERROR: rm terminated with error: Invalid argument
ASCMD> rm log-t0-r0-r1.arc
rm complete: +DS0/archive/log-t0-r0-r1.arc
cp, cpfromlocal, cptolocal
cp creates a new TAS file by copying an existing TAS file, pfromlocal creates a new TAS file by copying a local file, and cptolocal creates a local file by copying an existing TAS file. Each command also displays the copied file size, time taken to copy the file, and speed.
If the specified new file name already exists, an error message is displayed without copying the file.
Usage
cp {infile} {outfile} [-redun] [redun_no]
cpfromlocal {infile} {outfile} [-t] [file_type]
cptolocal {infile} {outfile} [-redun] [redun_no]
infile, outfile
Can be specified as absolute or relative paths. outfile is created by copying the
file specified by infile. The copied capacity, required time, and speed are output.
-redun redun_no
Specifies a mirror of a target file. Copies a mirror that corresponds to the redundancy number (redun_no). redun_no can has a number between 0 and 2,
depending on the redundancy level of the target file.
-t file_type
Determines the file type in a TAS configuration. (See 'V$AS_FILE'.)
-r, --recursive
Copies the directory.
-v, --verbose
Displays the processing results.
-b, --blksize
Defines the block size of the file.
--bs BYTES
Sets input and output block sizes to BYTES, determining the number of bytes
read and written at a time. This option overrides ibs and obs settings.
--ibs BYTES
Sets infile input and output block sizes to BYTES, determining the number of bytes
read from the infile at a time.
--obs BYTES
Sets outfile input and output block sizes to BYTES, determining the number of
bytes written to the outfile at a time.
--count N
Copies N number of blocks.
--skip N
Starts reading from the Nth block of the infile.
--seek N
Starts writing from the Nth block of the outfile.
Example
current path = +DS0/d0
ASCMD> du
File_name Used_mb Mirror used mb
f6.txt 2 4
f8.txt 9 18
Total mb 11 22
ASCMD> cp f6.txt f5.txt
2097152 bytes (2.00 MB) copied, 0.079874 s, 26.255753 MB/s
ASCMD> du
File_name Used_mb Mirror used mb
f5.txt 2 4
f6.txt 2 4
f8.txt 9 18
Total mb 13 26
mkdir
Creates a directory.
Usage
mkdir [-f] {dirname}
-f, --force
Ignores the existing directory and does not display an error message.
dirname
Name of a directory to create.
Example
current path = +DS0
<File_name>
c1.ctl
log0001.log
log0002.log
log0003.log
log0004.log
log0005.log
log0006.log
ASCMD> mkdir fd1
ASCMD> ls
<File_name>
c1.ctl
log0001.log
log0002.log
log0003.log
log0004.log
log0005.log
log0006.log
fd1/
mv
Moves a file.
Usage
mv [-v] {src_file} {dest_file}
-v
Displays the processing results.
src_file, dest_file
Can be designated as either an absolute or relative path. Files designated as
src_file are changed to dest_file.
Example
ASCMD +DS0/test> ls test.dtf
- Number of files found: 1
ASCMD +DS0/test> mv test.dtf mv_test.dtf
Moving file: +DS0/test/test.dtf -> +DS0/test/mv_test.dtf ASCMD +DS0/test> ls
mv_test.dtf
- Number of files found: 1
check
Checks compatibility of the TAS file information the user knows.
Usage
check [--ds_no] [ds_no] [--file_no] [file_no] [--blksize] [blksize] [-size] [size]
{filename}
--ds_no
Disk space number the user knows.
--file_no
File number the user knows.
--blksize
Block size the user knows.
--size
File size the user knows.
filename
Name of the file to be checked. An absolute or relative path can be entered.
Example
ASCMD +DS0> check log0001.log
FILE INFO (SIZE = BYTES)
DS_NO FILE_NO BLOCK_SIZE SIZE FILE_NAME
0 257 512 20971520 +DS0/log0001.log
file '+DS0/log0001.log' is consistent!
ASCMD +DS0> check --ds_no 0 --file_no 257 --blksize 512 --size 20971520 log0001.log
FILE INFO (SIZE = BYTES)
DS_NO FILE_NO BLOCK_SIZE SIZE FILE_NAME
0 257 512 20971520 +DS0/log0001.log
file '+DS0/log0001.log' is consistent!
TBASCMD Error Codes
The following describes causes and solutions for errors that may occur when using TAS.
ERROR CODE -1: invalid tas port number
Cause
A negative number, 0, or a non-numeric string was entered as a port number.
Action
Check the port number.
ERROR CODE -2: more arguments needed
Cause
No argument was entered when executing tbascmd.
Action
Enter a required argument.
ERROR CODE -3: invalid argument
Cause
An invalid argument was entered when executing tbascmd.
Action
Enter a valid argument.
ERROR CODE -4: connection failed
Cause
Failed to connect to a TAS instance through a port number.
Action
Check the port number or whether the TAS instance is running.
ERROR CODE -5: invalid command "INPUT CMD"
Cause
An invalid ascmd command was entered.
Action
Enter a valid ascmd command.
ERROR CODE -6: length of command cannot exceed "ASCMD_CMD_LEN_MAX"
Cause
The length of an entered ascmd command exceeds the maximum length.
Action
Enter an ascmd command with the length less than or equal to 2048 characters.
ERROR CODE -7: invalid option "INPUT OPTION" for command "INPUT CMD"
Cause
An entered ascmd command and option do not match.
Action
Check the ascmd command and option.
ERROR CODE -8: invalid option "INPUT OPTION"
Cause
An option that is not defined in ascmd was used.
Action
Enter an option that is defined in ascmd.
ERROR CODE -9: blksize cannot exceed "ASCMD_BLOCK_SIZE_MAX"
Cause
The block size entered as an option for the cpfromlocal command exceeds the
maximum size.
Action
Enter ASCMD_BLOCK_SIZE with the size less than or equal to 32 KB.
ERROR CODE -10: invalid file type "INPUT FILE TYPE" valid types [data, redo, ctrl, temp, arch]
Cause
The file type specified as an option for the cpfromlocal command is not one of
types defined in ascmd.
Action
Check if the file type specified as an option is defined in ascmd.
ERROR CODE -12: too many arguments for command "INPUT CMD"
Cause
The number of arguments for the ascmd command is greater than the required
number.
Action
Check the usage of the ascmd command.
ERROR CODE -13: need more arguments for command "INPUT CMD"
Cause
The number of arguments for the ascmd command is less than the required
number.
Action
Check the usage of the ascmd command.
ERROR CODE -14: invalid argument "INPUT ARG" for command "INPUT CMD"
Cause
One or more arguments were entered for a command that does not need an
argument.
Action
Check the usage of the ascmd command.
ERROR CODE -15: cannot parse NULL path
Cause
A file path is null.
Action
Enter a non-null file path.
ERROR CODE -16: length of path must be less than "ASCMD_PATH_LEN_MAX"
Cause
The length of a file path exceeds the maximum length.
Action
Enter a file path with the length less than or equal to 256 characters.
ERROR CODE -18: path "INPUT PATH" has invalid form
Cause
A file path format is invalid.
Action
Enter a valid file path.
ERROR CODE -19: no such path
Cause
An entered file or path does not exist.
Action
Enter a file or path that exists.
ERROR CODE -20: length of diskspace name must be less than "ASCMD_DS_NAME_LEN_MAX"
Cause
The length of a diskspace name exceeds the maximum length.
Action
Enter a diskspace name with the length less than or equal to 48 characters.
ERROR CODE -22: no such diskspace "INPUT DS NAME"
Cause
Failed to find a diskspace in an entered path.
Action
Create a diskspace in the entered path, or enter a path where the diskspace is
located.
ERROR CODE -23: no diskspace found
Cause
There is no diskspace.
Action
Create a diskspace.
ERROR CODE -24: length of file name must be less than "ASCMD_FILE_NAME_LEN_MAX"
Cause
The length of a file name exceeds the maximum length.
Action
Enter a file name with the length less than or equal to 48 characters.
ERROR CODE -25: invalid filename ‘FILENAME’
Cause
A file name is invalid.
Action
Enter a valid file name.
ERROR CODE -26: file 'FILENAME' already exists
Cause
A file name entered for the cp command already exists.
Action
Enter another file name.
ERROR CODE -27: length of directory path must be less than "ASCMD_PATH_LEN_MAX"
Cause
The length of a path exceeds the maximum length.
Action
Enter a path with the length less than or equal to 255 characters.
ERROR CODE -29: cannot use directory with cp command
Cause
One or more file names entered for the cp command are a directory path.
Action
Enter a file path or name.
ERROR CODE -30: cannot alloc memory
Cause
Failed to allocate memory to a buffer for file copy.
Action
Request analysis from Tmax research center.
ERROR CODE -31: asfd_pread failed
Cause
Failed to read a file while running the cp command.
Action
Check if the file paths and names are correct, and check permissions for the files.
ERROR CODE -32: asfd_pwrite failed
Cause
Failed to write a file while running the cp command.
Action
Check if the file paths and names are correct, and check permissions for the files.
ERROR CODE -33: file resize failed
Cause
Failed to resize a file for alignment.
Action
Request analysis from Tmax research center.
ERROR CODE -35: file name is not entered ascmd is not allowed to remove diskspace
Cause
A path used as an argument for the rm command has only a diskspace name
without a file name.
Action
Enter a valid file name. To remove a diskspace, use DROP DISKSPACE in tbsql.
ERROR CODE -36: ascmd command should be given after -c, --cmd option
Cause
A command was not entered after ascmd -c or --cmd.
Action
Check the usage of the ascmd command.
ERROR CODE -37: cannot open file
Cause
Failed to open a file while running the cp command. The causes are various.
Action
Request analysis from Tmax research center.
ERROR CODE -38: tas failed to get ds list
Cause
Failed to read a diskspace list.
Action
Request analysis from Tmax research center.
ERROR CODE -39: tas failed to get file info
Cause
Failed to get file information such as a file size and redun number.
Action
Request analysis from Tmax research center.
ERROR CODE -40: valid input should be given to option 'OPTION'
Cause
An invalid value was entered after cpfromlocal -b, --blksize, -t, --type, or another option.
Action
Check the usage of the cpfromlocal command.
Last updated