Michael Phelps made one last swim at the Beijing Olympics Sunday. He joined with three team members to win the 4x100-meter medley relay final. That gave Phelps a record eight gold medals in one Olympics. "To have ups, to have downs and go through everything, and be able to accomplish everything you have ever really dreamed of, it is fun," said Phelps. "It feels good. From here, I guess it is to continue with my goal of raising the sport of swimming as high as I can get it in the United States." "I don't want to lose," Phelps says. "That's the thing. If I don't want to lose, I can focus." "Not accomplishing a goal, no matter what it is for me, just makes me want it that much more," Phelps says. "When I didn't medal, I was like, 'All right, well, then I'm going to do this.' " Within seven months, he set a world record in the 200 butterfly. Even now, Phelps trains every day — including Sundays, figuring it gives him 52 more days a year in the pool than many of his competitors. In peak training phases, Phelps will swim at least 80,000 meters a week, nearly 50 miles. That includes two practices a day, sometimes three when he's training at altitude. "His motivation is that he just hates to lose," says U.S. teammate Ian Crocker, who will race against Phelps in Beijing in the 100 butterfly. "He's got a lot of biological advantages plus that desire."
August 23, 2008
What did you learn from Phelps?
August 21, 2008
Oracle Datatypes
Datatype summary for Oracle 7, 8 & 9i
| Datatype | Description | Max Size: Oracle 7 |
Max Size: Oracle 8 |
Max Size: Oracle 9 |
Max Size: PL/SQL |
PL/SQL Subtypes/ Synonyms |
| VARCHAR2(size) | Variable length character string having maximum length size bytes. You must specify size |
2000 bytes minimum is 1 |
4000 bytes minimum is 1 |
4000 bytes minimum is 1 |
32767 bytes minimum is 1 |
STRING VARCHAR |
| NVARCHAR2(size) | Variable length national character set string having maximum length size bytes. You must specify size |
N/A | 4000 bytes minimum is 1 |
4000 bytes minimum is 1 |
32767 bytes minimum is 1 |
STRING VARCHAR |
| VARCHAR | Now deprecated – VARCHAR is a synonym for VARCHAR2 but this usage may change in future versions. | - | - | - | ||
| CHAR(size) | Fixed length character data of length size bytes. This should be used for fixed length data. Such as codes A100, B102… | 255 bytes Default and minimum size is 1 byte. |
2000 bytes Default and minimum size is 1 byte. |
2000 bytes Default and minimum size is 1 byte. |
32767 bytes Default and minimum size is 1 byte. |
CHARACTER |
| NCHAR(size) | Fixed length national character set data of length size bytes. This should be used for fixed length data. Such as codes A100, B102… | N/A | 2000 bytes Default and minimum size is 1 byte. |
2000 bytes Default and minimum size is 1 byte. |
32767 bytes Default and minimum size is 1 byte. |
|
| NUMBER(p,s) | Number having precision p and scale s. | The precision p can range from 1 to 38.The scale s can range from -84 to 127. | The precision p can range from 1 to 38.The scale s can range from -84 to 127. | The precision p can range from 1 to 38.The scale s can range from -84 to 127. | Magnitude 1E-130 .. 10E125maximum precision of 126 binary digits, which is roughly equivalent to 38 decimal digits The scale s can range from -84 to 127. For floating point don’t specify p,s REAL has a maximum precision of 63 binary digits, which is roughly equivalent to 18 decimal digits |
fixed-point numbers: DEC DECIMAL NUMERICintegers: INTEGER INT SMALLINT floating-point: REAL |
| PLS_INTEGER | signed integers PLS_INTEGER values require less storage and provide better performance than NUMBER values. So use PLS_INTEGER where you can! |
PL/SQL only | PL/SQL only | PL/SQL only | magnitude range is -2147483647 .. 2147483647 | |
| BINARY_INTEGER | signed integers (older slower version of PLS_INTEGER) | magnitude range is -2147483647 .. 2147483647 | ||||
| LONG | Character data of variable length (A bigger version the VARCHAR2 datatype) | 2 Gigabytes | 2 Gigabytes | 2 Gigabytes – but now deprecated | 32760 bytes Note this is smalller than the maximum width of a LONG column |
|
| DATE | Valid date range | from January 1, 4712 BC to December 31, 4712 AD. | from January 1, 4712 BC to December 31, 9999 AD. | from January 1, 4712 BC to December 31, 9999 AD. | from January 1, 4712 BC to December 31, 9999 AD. (in Oracle7 = 4712 AD) |
|
| TIMESTAMP (fractional_seconds_precision) | the number of digits in the fractional part of the SECOND datetime field. | - | - | Accepted values of fractional_seconds_precision are 0 to 9. (default = 6) | ||
| TIMESTAMP (fractional_seconds_precision) WITH {LOCAL} TIMEZONE | As above with time zone displacement value | - | - | Accepted values of fractional_seconds_precision are 0 to 9. (default = 6) | ||
| INTERVAL YEAR (year_precision) TO MONTH | Time in years and months, where year_precision is the number of digits in the YEAR datetime field. | - | - | Accepted values are 0 to 9. (default = 2) | ||
| INTERVAL DAY (day_precision) TO SECOND (fractional_seconds_precision) | Time in days, hours, minutes, and seconds.day_precision is the maximum number of digits in ‘DAY’
fractional_seconds_precision is the max number of fractional digits in the SECOND field. |
- | - | day_precision may be 0 to 9. (default = 2)fractional_seconds_precision may be 0 to 9. (default = 6) | ||
| RAW(size) | Raw binary data of length size bytes. You must specify size for a RAW value. |
Maximum size is 255 bytes. | Maximum size is 2000 bytes | Maximum size is 2000 bytes | 32767 bytes | |
| LONG RAW | Raw binary data of variable length. (not intrepreted by PL/SQL) | 2 Gigabytes. | 2 Gigabytes. | 2 Gigabytes – but now deprecated | 32760 bytes Note this is smalller than the maximum width of a LONG RAW column |
|
| ROWID | Hexadecimal string representing the unique address of a row in its table. (primarily for values returned by the ROWID pseudocolumn.) |
Hexadecimal string representing the unique address of a row in its table. (primarily for values returned by the ROWID pseudocolumn.) |
||||
| UROWID | Hex string representing the logical address of a row of an index-organized table | N/A | The maximum size and default is 4000 bytes | The maximum size and default is 4000 bytes | universal rowid – Hex string representing the logical address of a row of an index-organized table, either physical, logical, or foreign (non-Oracle) | See CHARTOROWID and the package: DBMS_ROWID |
| MLSLABEL | Binary format of an operating system label.This datatype is used with Trusted Oracle7. | |||||
| CLOB | Character Large Object | 4Gigabytes | 4Gigabytes | 4Gigabytes | 4Gigabytes | |
| NCLOB | National Character Large Object | 4Gigabytes | 4Gigabytes | 4Gigabytes | ||
| BLOB | Binary Large Object | 4Gigabytes | 4Gigabytes | 4Gigabytes | ||
| BFILE | pointer to binary file on disk | 4Gigabytes | 4Gigabytes | The size of a BFILE is system dependent but cannot exceed four gigabytes (2**32 – 1 bytes). | ||
| XMLType | XML data | - | - | 4Gigabytes | Populate with XML from a CLOB or VARCHAR2.or query from another XMLType column. |
Notes and Examples
VARCHAR2:
Storing character data as Varchar2 will save space:
Store ‘SMITH’ not ‘SMITH ‘
CHAR:
Over time, when varchar2 columns are updated they will sometimes create chained rows – because CHAR columns are fixed width they are not affected by this – so less DBA effort is required to maintain performance.
PL/SQL
When retrieving data for a NUMBER column, consider (if you can) using the PL/SQL datatype: PLS_INTEGER for better performance.
LONG
You should start using BLOB instead of LONG
INTEGER
This ANSI datatype will be accepted by Oracle – it is actually a synonym for NUMBER(38)
The FLOAT datatype
This ANSI datatype will be accepted by Oracle – Very similar to NUMBER it stores zero, positive, and negative floating-point numbers
The NUMBER datatype
Stores zero, positive, and negative numbers, fixed or floating-point numbers
Fixed-point NUMBER
NUMBER(p,s)
precision p = length of the number in digits
scale s = places after the decimal point, or (for negative scale values) significant places before the decimal point.Integer NUMBER
NUMBER(p)
This is a fixed-point number with precision p and scale 0. Equivalent to NUMBER(p,0)Floating-Point NUMBER
NUMBER
floating-point number with decimal precision 38
Confusingly the Units of measure for PRECISION vary according to the datatype.
For NUMBER data types: precision p = Number of Digits
For FLOAT data types: precision p = Binary Precision (multiply by 0.30103 to convert)
{So FLOAT = FLOAT (126) = 126 x 0.30103 = approx 37.9 digits of precision.}
Example
The value 7,456,123.89 will display as follows NUMBER(9) 7456124 NUMBER(9,1) 7456123.9 NUMBER(*,1) 7456123.9 NUMBER(9,2) 7456123.89 NUMBER(6) [not accepted exceeds precision] NUMBER(7,-2) 7456100 NUMBER 7456123.89 FLOAT 7456123.89 FLOAT(12) 7456000.0
Oracle stores all numeric data in variable length format.
Storage space is therefore dependent on the length of all the individual values stored in the table. Precision and scale settings do not affect storage requirements. DATA_SCALE may appear to be truncating data, but Oracle still stores the exact values as input. DATA_PRECISION can be used to constrain input values.
It is possible to save storage space by having an application truncate a fractional value before inserting into a table, but you have to be very sure the logic and maths still make sense. (This is unlikely to be the case)
SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH, DATA_PRECISION, DATA_SCALE
FROM cols WHERE table_name = ‘Your_Table’;
A common space-saving trick is storing boolean values as an Oracle CHAR, rather than NUMBER:
CREATE TABLE my_demo (accountcode NUMBER, postableYN CHAR check (postableYN in (0,1)) );
– Standard logical values: 1=True and 0=False
insert into my_demo values(525, ‘1′);
insert into my_demo values(526, ‘0′);
SELECT accountcode, decode(postableYN,1,’True’,0,’False’) FROM my_demo;
or
SELECT accountcode, decode(postableYN,1,’Oui’,0,’Non’) FROM my_demo;
Comparison with other RDBMS’s
| int10 | int6 | int1 | char(n) | blob | XML | |
| Oracle 9 | NUMBER(10) | NUMBER(6) | NUMBER(1) | VARCHAR2(n) | BLOB | XMLType |
| MS SQL Server 2005 | NUMERIC(10) | NUMERIC(6) | TINYINT | VARCHAR(n) | IMAGE | XML |
| Sybase system 10 | NUMERIC(10) | NUMERIC(6) | NUMERIC(1) | VARCHAR(n) | IMAGE | |
| MS Access (Jet) | Long Int or Double | Single | Byte | TEXT(n) | LONGBINARY | |
| TERADATA | INTEGER | DECIMAL(6) | DECIMAL(1) | VARCHAR(n) | VARBYTE(20480) | |
| DB2 | INTEGER | DECIMAL(6) | DECIMAL(1) | VARCHAR(n) | VARCHAR(255) | |
| RDB | INTEGER | DECIMAL(6) | DECIMAL(1) | VARCHAR(n) | LONG VARCHAR | |
| INFORMIX | INTEGER | DECIMAL(6) | DECIMAL(1) | VARCHAR(n) | BYTE | |
| RedBrick | integer | int | int | char(n) | char(1024) | |
| INGRES | INTEGER | INTEGER | INTEGER | VARCHAR(n) | VARCHAR(1500) |
Also consider the maximum length of a table name (or column name) and the maximum size of an SQL statement – these limits vary considerably between products and versions.
Getting Yesterdays or Tomorrows day with shell date command
When invoked without arguments, the date command displays the current date and time. Depending on the options specified, date will set the date and time or print it in a user defined way. I’ve seen many people writing a perl script for calculating yesterday or tomorrow. Computer loves numbers but we love relative terms like 2 days ago. Luckily GNU date command is designed to handle relative date calculation.
Why use relative date formats?
[a] Ease of use
[b] To write your own scripts
[c] Automate task using cron (example run a job on last day of the month or Nth day of the month or 3rd Friday and so on)
First print today’s date:
$ date
Sun Jun 17 12:17:24 CDT 2007
Now display Yesterday’s date:
$ date --date="1 days ago"
OR try:
$ date --date="yesterday"
Sat Jun 16 12:17:20 CDT 2007
Now display Tomorrow’s date:
$ date --date="-1 days ago"
Or better try:
$ date --date="next day"
Sat Jun 16 12:17:20 CDT 2007
Getting date in the future
To get tomorrow and day after tomorrow (tomorrow+N) use day word to get date in the future:
Getting date in the past
To get yesterday and earlier day in the past use string day ago:
Moving by whole years or months
You can add year and months keywords to get more accurate date:
$ date --date='2 year ago' # past
$ date --date='3 years' # go into future
$ date --date='2 days' # future
$ date --date='1 month ago' # past
$ date --date='2 months' # future
Moving date using more precise units
- You can use fortnight for 14 day
- Week for 7 days
- hour for 60 minutes
- minute for 60 seconds
- second for one second
- You can also use this / now / today keywords to stress the meaning
To print the date of this Friday:
$ date --date='this Friday'
To print the date of the day six months and 15 day
$ date --date='6 months 15 day'
To print the date of the day two months and 5 days ago:
$ date --date='2 months 5 day ago'
You can also use relative format to setup date and time. For example to set the system clock forward by 30 minutes, enter:
# date --set='+30 minutes'
To display date in epoch time:
$ date --date='1970-01-01 00:00:01 UTC +5 hours' +%s
http://www.cyberciti.biz/tips/linux-unix-get-yesterdays-tomorrows-date.html
Linux date 命令使用技巧
date命令
date命令的功能是显示和设置系统日期和时间。
该命令的一般格式为: date [选项] 显示时间格式(以+开头,后面接格式)
date 设置时间格式
命令中各选项的含义分别为:
-d datestr, –date datestr 显示由datestr描述的日期
-s datestr, –set datestr 设置datestr 描述的日期
-u, –universal 显示或设置通用时间
时间域
% H 小时(00..23)
% I 小时(01..12)
% k 小时(0..23)
% l 小时(1..12)
% M 分(00..59)
% p 显示出AM或PM
% r 时间(hh:mm:ss AM或PM),12小时
% s 从1970年1月1日00:00:00到目前经历的秒数
% S 秒(00..59)
% T 时间(24小时制)(hh:mm:ss)
% X 显示时间的格式(%H:%M:%S)
% Z 时区 日期域
% a 星期几的简称( Sun..Sat)
% A 星期几的全称( Sunday..Saturday)
% b 月的简称(Jan..Dec)
% B 月的全称(January..December)
% c 日期和时间( Mon Nov 8 14:12:46 CST 1999)
% d 一个月的第几天(01..31)
% D 日期(mm/dd/yy)
% h 和%b选项相同
% j 一年的第几天(001..366)
% m 月(01..12)
% w 一个星期的第几天(0代表星期天)
% W 一年的第几个星期(00..53,星期一为第一天)
% x 显示日期的格式(mm/dd/yy)
% y 年的最后两个数字( 1999则是99)
% Y 年(例如:1970,1996等)
需要特别说明的是,只有超级用户才能用date命令设置时间,一般用户只能用date命令显示时间。
例1:用指定的格式显示时间。
$ date ‘+This date now is =>%x ,time is now =>%X ,thank you !’
This date now is =>11/12/99 ,time is now =>17:53:01 ,thank you !
例2:用预定的格式显示当前的时间。
# date
Fri Nov 26 15:20:18 CST 1999
例3:设置时间为下午14点36分。
# date -s 14:36:00
Fri Nov 26 14:15:00 CST 1999
例4:设置时间为1999年11月28号。
# date -s 991128
Sun Nov 28 00:00:00 CST 1999
例5:设置一天前
date –date “1 days ago” +”%Y-%m-%d”
Date 命令参数小技巧
LastUpdated:2006-03-27
By:Gman!
-for beginner:wink:此参数可以用于日志处理和时间统计;
由于Linux对man date -d 参数说的比较模糊,故举例如下:
# -d, –date=STRING display time described by STRING, not `now’
For Linux
[root@Gman root]# date -d next-day +%Y%m%d
20060328
[root@Gman root]# date -d last-day +%Y%m%d
20060326
[root@Gman root]# date -d yesterday +%Y%m%d
20060326
[root@Gman root]# date -d tomorrow +%Y%m%d
20060328
[root@Gman root]# date -d last-month +%Y%m
200602
[root@Gman root]# date -d next-month +%Y%m
200604
[root@Gman root]# date -d next-year +%Y
2007
——————————————————————————
而FreeBSD则不同;举例如下:
For FreeBSD
bash-2.05b# date -v -1d +%Y%m%d
20060326
bash-2.05b# date -v -1m +%Y%m%d
20060227
bash-2.05b# date -v -1y +%Y%m%d
20050327
http://www.zks.cn/article.asp?id=41
F5 and F9 in TOAD
Pre-9.0 vs 9.0 Usability Matrix
| Operation | v6-8.6 | v9.0 |
|---|---|---|
| Execute Statement (Editor contains 1 statement) |
||
| Execute Statement at Cursor | or SHIFT F9 (w/o delimiters) |
|
| Execute Multiple Statements | ||
| Compile PL/SQL Object at Cursor | ||
| Compile All PL/SQL in Tab | Not Possible | Mouse Right-Click in Navigator “Compile All” |
August 15, 2008
netrc
netrc, .netrc – user configuration for ftp
Description
This file contains configuration and autologin information for the File Transfer Protocol client ftp(1).
The .netrc file contains login and initialization information used by the auto-login process. It resides in the user’s home directory. The following tokens are recognized; they may be separated by spaces, tabs, or new-lines:
machine name
- Identify a remote machine name. The auto-login process searches the .netrc file for a machine token that matches the remote machine specified on the ftp command line or as an open command argument. Once a match is made, the subsequent .netrc tokens are processed, stopping when the end of file is reached or another machine or a default token is encountered.default
This is the same as machine name except that default matches any name. There can be only one default token, and it must be after all machine tokens. This is normally used as:default login anonymous password user@site
thereby giving the user automatic anonymous ftp login to machines not specified in .netrc. This can be overridden by using the -n flag to disable auto-login.
login name
Identify a user on the remote machine. If this token is present, the auto-login process will initiate a login using the specified name.password string
Supply a password. If this token is present, the auto-login process will supply the specified string if the remote server requires a password as part of the login process. Note that if this token is present in the .netrc file for any user other than anonymous, ftp will abort the auto-login process if the .netrc is readable by anyone besides the user.account string
Supply an additional account password. If this token is present, the auto-login process will supply the specified string if the remote server requires an additional account password, or the auto-login process will initiate an ACCT command if it does not.macdef name
Define a macro. This token functions like the ftp macdef command functions. A macro is defined with the specified name; its contents begin with the next .netrc line and continue until a null line (consecutive new-line characters) is encountered. If a macro named init is defined, it is automatically executed as the last step in the auto-login process.
UNIX 下 SCO TCP/IP ftp 命令表
| UNIX 下 SCO TCP/IP ftp 命令表 | ||
| 序号 | 命 令 | 功 能 |
| 1 | ! | 执行本地 shell 命令 |
| 2 | $ | 执行宏功能 |
| 3 | account | 发送帐号口令到远程服务器 |
| 4 | append | 附加到文件中 |
| 5 | ascii | 设置 ASCII 码传输类型 |
| 6 | bell | 命令完成时响铃 |
| 7 | binaey | 设置二进制码传输类型 |
| 8 | bye | 结束并退出 ftp |
| 9 | case | 触发远程文件名大小写变化功能 |
| 10 | cd | 改变远程工作目录 |
| 11 | cdup | 把远程工作目录改为其父目录 |
| 12 | close | 结束 ftp |
| 13 | cr | 触发回车换行功能 |
| 14 | delete | 删除远程文件 |
| 15 | debug | 触发调试方式 |
| 16 | dir | 列远程目录 |
| 17 | disconnect | 结束 ftp |
| 18 | form | 设置文件传输格式 |
| 19 | get | 取文件 |
| 20 | glob | 触发本地文件名元字母扩展功能 |
| 21 | hash | 为每个传输缓区触发#号打印功能 |
| 22 | help | 显示求助信息 |
| 23 | lcd | 改变本地工作目录 |
| 24 | ls | 列远程工作目录内容 |
| 25 | macdef | 定义宏功能 |
| 26 | mdelete | 删除远程主机上的多个文件 |
| 27 | mdir | 列多个远程目录的内容 |
| 28 | mget | 取多个文件 |
| 29 | mkdir | 在远程主机上建新目录 |
| 30 | mls | 列多个远程目录的内容 |
| 31 | mode | 设置文件传输方式 |
| 32 | mput | 发送多个文件 |
| 33 | nmap | 设置或取消文件名映射机制 |
| 34 | ntrans | 设置或取消文件名字符变换机制 |
| 35 | open | 连接远程主机 |
| 36 | prompt | 触发交互提示功能 |
| 37 | proxy | 在辅助控制连接上执行一条 ftp 命令 |
| 38 | put | 发送一个文件 |
| 39 | pwd | 显示远程机器上的工作目录 |
| 40 | quit | 结束并退出 ftp |
| 41 | quote | 发送任意 ftp 命令 |
| 42 | recv | 取文件 |
| 43 | remotehelp | 取远程主机的求助信息 |
| 44 | rename | 重新命名远程文件 |
| 45 | reset | 清除应答队列 |
| 46 | rmdir | 删除远程主机的一个目录 |
| 47 | runique | 触发用本地唯一文件名存储功能 |
| 48 | send | 发送一个文件 |
| 49 | sendport | 为每个数据连接触发使用 PORT |
| 50 | status | 显示当前状态 |
| 51 | struct | 设置文件传输结构 |
| 52 | sunique | 触发远程唯一主机文件存储功能 |
| 53 | tenex | 设置 tenex 文件传输类型 |
| 54 | trace | 触发分组跟踪功能 |
| 55 | type | 设置文件传输类型 |
| 56 | user | 发送新的用户信息 |
| 57 | verbose | 触发 verbose 方式 |
| 58 | xmkdir | 生成远程主机目录 |
| 59 | xpwd | 显示远程主机工作目录 |
| 60 | xrmdir | 删除远程主机目录 |
| 61 | ? | 显示本地 ftp 求助信息 |
| 不同的系统,上述命令可能有所差异,可用“?”获得帮助! | ||
http://www.mypcera.com/softxue/txt1/ftpcmd.htm
Setting a Column to a Unique Sequence Number
The SEQUENCE keyword ensures a unique value for a particular column. SEQUENCE increments for each record that is loaded or rejected. It does not increment for records that are discarded or skipped.
column_name
The name of the column in the database to which to assign the sequence.
SEQUENCE
Use the SEQUENCE keyword to specify the value for a column.
n
Specifies the specific sequence number to begin with
COUNT
The sequence starts with the number of rows already in the table plus the increment.
MAX
The sequence starts with the current maximum value for the column plus the increment.
increment
The value that the sequence number is to increment after a record is loaded or rejected
Control file
The APPEND clause is one of the options you can use when loading data into a table that is not empty.
To load data into a table that is empty, you would use the INSERT clause.
The TRAILING NULLCOLS clause tells SQL*Loader to treat any relatively positioned columns that are not present in the record as null columns.
Comments in the Control File
Comments can appear anywhere in the command section of the file, but they should not appear within the data. Precede any comment with two hyphens, for example:
-- This is a comment
How To use the Sequence Function of SQL*Loader
Note:1058895.6
Description and Example of Sequence Function:
=============================================
create table t1
(field1 number, field2 number, field3 varchar2(10));
The following script should be able to load the data :
load data
infile *
into table t1
fields terminated by "," optionally enclosed by '"'
(field1 SEQUENCE(MAX,1), field2, field3)
begindata
1234, "ABC"
3456, "CDF"
Here the SEQUENCE starts with the current maximum value for the
column, and adds 1 to it before loading.
SQL> select * from t1;
FIELD1 FIELD2 FIELD3
---------- ---------- ----------
1 1234 ABC
2 3456 CDF
Explanation:
============
The SEQUENCE keyword ensures a unique value for a particular column.
SEQUENCE, function, increments for each record that is loaded. It
does not increment for records that are discarded or skipped.
SEQUENCE function takes two optional arguments :
SEQUENCE(n,increment) - sequence starts with the integer value n
specified by the user, plus the increment
SEQUENCE(COUNT,increment) - sequence starts with the number of rows
already in the table, plus the increment
SEQUENCE(MAX, increment) - sequence starts with the current maximum
value for the column, plus the increment
August 13, 2008
飞鱼菲尔普斯之谜
天赋=肺活量+乳酸
身高1.93米,79公斤的菲尔普斯,肩宽腰窄,是典型的游泳选手的体格,但他却又是这典型中的另类,因为他的上肢特别长,而腿特别短,这使他在水中仿佛是一架又细又长的帆船。而且菲尔普斯天生拥有水性,“蝶泳腿好是菲尔普斯的杀手閒,仰泳、自由泳和蝶泳的蹬腿动作有些类似。菲尔普斯在这方面有独特的技术,转身时,常常比其他选手浅,所以快。”前奥运冠军钱红这样解释菲尔普斯神奇的奥秘。而另一位奥运冠军罗雪娟似乎更仔细研究过菲尔普斯,“菲尔普斯肺活量达到一万五,乳酸分泌却是正常人的一半,所以不太容易疲劳。”而正常人的肺活量为3500左右,即使是刚刚夺得奥运会男子400米自由泳冠军的朴泰桓也只有7000,足见菲尔普斯是天生的游泳天才。
而美国媒体更是这样形容菲尔普斯,“上帝根据游泳项目的特性量身定造了菲尔普斯。”
天才=刻苦+偏执
当然,仅有天赋而没有后天的努力是不会变成天才的,这一点菲尔普斯给出了最好的诠释。“如果你休息一天,实力就会倒退两天。”这是菲尔普斯的座右铭,也是他教练送给他的至理名言,菲尔普斯一直深信,“如果浪费两天的话,也许就再也追不回来了。”
一直以来,他都坚持早上5点鐘起床训练的习惯,从未间断,这是不可想像的。他就是这样近乎偏执地坚持着,以至于菲尔普斯在美国游泳队被戏称为“启明星”。更让人惊嘆的是菲尔普斯的毅力,他在过去的7年时间,2500多个日子中仅有5天没有下过水。正是在这样近乎偏执的努力下,菲尔普斯取得了令人仰视的成就。
游泳事业之外,迈克尔是一名普通的少年.他通常与自己家的猫萨凡纳一起入睡,这只猫就蜷睡在他的旁边.他早上也不愿意起床,但一旦开始一天的工作,他就不会有丝毫疏懒.
迈克尔的目标不仅仅是在奥运会上获得荣耀,他要改变自己从事的体育活动,就像迈克尔·乔丹及泰格·伍兹这些伟大的运动员曾经做到的那样.
1997年,迈克尔·菲尔普斯11岁的时候,他的教练鲍曼发现他具有奥运冠军的素质。
鲍曼说:“你会看到他总是迫不及待地跳入水中,他给自己的压力远远超过别人对他的要求,我尽量做到不喜形于色,尽管我为他的表现感叹不已。”
鲍曼注意到菲尔普斯能轻松学会别的少年所不能掌握得的技巧,这位教练知道他面对的是一位游泳天才,于是他对菲尔普斯的父母说:“迈克尔天赋极佳,他的潜力是无限的。”
游泳池外的菲尔普斯是个典型的随意少年,他喜欢嘻哈摇滚,玩电脑游戏,喜欢和朋友们闲逛。2003年,他从马里兰州的道森高中毕业,计划奥运会后上大学。
然而,菲尔普斯一跳入泳池就不再是那个平凡的少年了。他身高6英尺5英寸,体重185磅,浑身没有一丝赘肉,游起来像鱼一样在水中划过,他蹬腿动作非常有力,双腿好像装有发动机。
曾在2000年悉尼奥运会上获得三枚金牌的美国仰泳运动员伦尼•克雷泽伯格说:“我还从没有见过像他那样的人,没有人像他那样样样出色。”
菲尔普斯认为他的成功很大部分要归功于训练。从高中毕业后,大多数时间都是从早晨7点中开始长达2个半小时的训练,中餐后稍稍打个盹,然后接着游,一直从下午3点半到6点。
总之,他每天游的距离多达12英里,他说:“我知道没有人比我训练更刻苦。”
菲尔普斯训练如此刻苦是因为他憎恨失败。他7岁开始游泳,但直到11岁教练鲍曼和他父母谈过以后才开始认真对待这项运动。
他回忆说:“如果没有发挥自己的最佳水平,我就会不停地去想它,上学的时候想,和朋友在一起的时候想。这样会让我发疯的。”
Sys_Context Function
In Oracle/PLSQL, the sys_context function can be used to retrieve information about the Oracle environment.
The syntax for the sys_context function is:
sys_context( namespace, parameter, [ length ] )
namespace is an Oracle namespace that has already been created. If the namespace of ‘USERENV’ is used, attributes describing the current Oracle session can be returned.
parameter is a valid attribute that has been set using the DBMS_SESSION.set_context procedure.
length is optional. It is the length of the return value in bytes. If this parameter is omitted or if an invalid entry is provided, the sys_context function will default to 256 bytes.
The valid parameters for the namespace called ‘USERENV’ are as follows:
Parameter Explanation Return Length AUDITED_CURSORID Returns the cursor ID of the SQL that triggered the audit N/A AUTHENTICATION_DATA Authentication data 256 AUTHENTICATION_TYPE Describes how the user was authenticated. Can be one of the following values: Database, OS, Network, or Proxy 30 BG_JOB_ID If the session was established by an Oracle background process, this parameter will return the Job ID. Otherwise, it will return NULL. 30 CLIENT_IDENTIFIER Returns the client identifier (global context) 64 CLIENT_INFO User session information 64 CURRENT_SCHEMA Returns the default schema used in the current schema 30 CURRENT_SCHEMAID Returns the identifier of the default schema used in the current schema 30 CURRENT_SQL Returns the SQL that triggered the audit event 64 CURRENT_USER Name of the current user 30 CURRENT_USERID Userid of the current user 30 DB_DOMAIN Domain of the database from the DB_DOMAIN initialization parameter 256 DB_NAME Name of the database from the DB_NAME initialization parameter 30 ENTRYID Available auditing entry identifier 30 EXTERNAL_NAME External of the database user 256 FG_JOB_ID If the session was established by a client foreground process, this parameter will return the Job ID. Otherwise, it will return NULL. 30 GLOBAL_CONTEXT_MEMORY The number used in the System Global Area by the globally accessed context N/A HOST Name of the host machine from which the client has connected 54 INSTANCE The identifier number of the current instance 30 IP_ADDRESS IP address of the machine from which the client has connected 30 ISDBA Returns TRUE if the user has DBA privileges. Otherwise, it will return FALSE. 30 LANG The ISO abbreviate for the language 62 LANGUAGE The language, territory, and character of the session. In the following format:
language_territory.characterset52 NETWORK_PROTOCOL Network protocol used 256 NLS_CALENDAR The calendar of the current session 62 NLS_CURRENCY The currency of the current session 62 NLS_DATE_FORMAT The date format for the current session 62 NLS_DATE_LANGUAGE The language used for dates 62 NLS_SORT BINARY or the linguistic sort basis 62 NLS_TERRITORY The territory of the current session 62 OS_USER The OS username for the user logged in 30 PROXY_USER The name of the user who opened the current session on behalf of SESSION_USER 30 PROXY_USERID The identifier of the user who opened the current session on behalf of SESSION_USER 30 SESSION_USER The database user name of the user logged in 30 SESSION_USERID The database identifier of the user logged in 30 SESSIONID The identifier of the auditing session 30 TERMINAL The OS identifier of the current session 10
Applies To:
- Oracle 8i, Oracle 9i, Oracle 10g, Oracle 11g
http://www.techonthenet.com/oracle/functions/sys_context.php
select sysdate from dual;
select USER from dual;
select UID from dual;
select * from dba_users
select
SYS_CONTEXT(‘USERENV’,'TERMINAL’) terminal,
SYS_CONTEXT(‘USERENV’,'LANGUAGE’) language,
SYS_CONTEXT(‘USERENV’,'SESSIONID’) sessionid,
SYS_CONTEXT(‘USERENV’,'INSTANCE’) instance,
SYS_CONTEXT(‘USERENV’,'ENTRYID’) entryid,
SYS_CONTEXT(‘USERENV’,'ISDBA’) isdba,
SYS_CONTEXT(‘USERENV’,'NLS_TERRITORY’) nls_territory,
SYS_CONTEXT(‘USERENV’,'NLS_CURRENCY’) nls_currency,
SYS_CONTEXT(‘USERENV’,'NLS_CALENDAR’) nls_calendar,
SYS_CONTEXT(‘USERENV’,'NLS_DATE_FORMAT’) nls_date_format,
SYS_CONTEXT(‘USERENV’,'NLS_DATE_LANGUAGE’) nls_date_language,
SYS_CONTEXT(‘USERENV’,'NLS_SORT’) nls_sort,
SYS_CONTEXT(‘USERENV’,'CURRENT_USER’) current_user,
SYS_CONTEXT(‘USERENV’,'CURRENT_USERID’) current_userid,
SYS_CONTEXT(‘USERENV’,'SESSION_USER’) session_user,
SYS_CONTEXT(‘USERENV’,'SESSION_USERID’) session_userid,
SYS_CONTEXT(‘USERENV’,'PROXY_USER’) proxy_user,
SYS_CONTEXT(‘USERENV’,'PROXY_USERID’) proxy_userid,
SYS_CONTEXT(‘USERENV’,'DB_DOMAIN’) db_domain,
SYS_CONTEXT(‘USERENV’,'DB_NAME’) db_name,
SYS_CONTEXT(‘USERENV’,'HOST’) host,
SYS_CONTEXT(‘USERENV’,'OS_USER’) os_user,
SYS_CONTEXT(‘USERENV’,'EXTERNAL_NAME’) external_name,
SYS_CONTEXT(‘USERENV’,'IP_ADDRESS’) ip_address,
SYS_CONTEXT(‘USERENV’,'NETWORK_PROTOCOL’) network_protocol,
SYS_CONTEXT(‘USERENV’,'BG_JOB_ID’) bg_job_id,
SYS_CONTEXT(‘USERENV’,'FG_JOB_ID’) fg_job_id,
SYS_CONTEXT(‘USERENV’,'AUTHENTICATION_TYPE’)
FROM DUAL
select SYS_CONTEXT(‘USERENV’,'SID’) SESSION_ID
FROM DUAL
select * from v$mystat where rownum < 2
Grant/Revoke Privileges
Grant Privileges on Tables
You can grant users various privileges to tables. These privileges can be any combination of select, insert, update, delete, references, alter, and index. Below is an explanation of what each privilege means.
Privilege Description Select Ability to query the table with a select statement. Insert Ability to add new rows to the table with the insert statement. Update Ability to update rows in the table with the update statement. Delete Ability to delete rows from the table with the delete statement. References Ability to create a constraint that refers to the table. Alter Ability to change the table definition with the alter table statement. Index Ability to create an index on the table with the create index statement.
The syntax for granting privileges on a table is:
grant privileges on object to user;
For example, if you wanted to grant select, insert, update, and delete privileges on a table called suppliers to a user name smithj, you would execute the following statement:
grant select, insert, update, delete on suppliers to smithj;
You can also use the all keyword to indicate that you wish all permissions to be granted. For example:
grant all on suppliers to smithj;
If you wanted to grant select access on your table to all users, you could grant the privileges to the public keyword. For example:
grant select on suppliers to public;
Revoke Privileges on Tables
Once you have granted privileges, you may need to revoke some or all of these privileges. To do this, you can execute a revoke command. You can revoke any combination of select, insert, update, delete, references, alter, and index.
The syntax for revoking privileges on a table is:
revoke privileges on object from user;
For example, if you wanted to revoke delete privileges on a table called suppliers from a user named anderson, you would execute the following statement:
revoke delete on suppliers from anderson;
If you wanted to revoke all privileges on a table, you could use the all keyword. For example:
revoke all on suppliers from anderson;
If you had granted privileges to public (all users) and you wanted to revoke these privileges, you could execute the following statement:
revoke all on suppliers from public;
Grant Privileges on Functions/Procedures
When dealing with functions and procedures, you can grant users the ability to execute these functions and procedures. The Execute privilege is explained below:
Privilege Description Execute Ability to compile the function/procedure.
Ability to execute the function/procedure directly.
The syntax for granting execute privileges on a function/procedure is:
grant execute on object to user;
For example, if you had a function called Find_Value and you wanted to grant execute access to the user named smithj, you would execute the following statement:
grant execute on Find_Value to smithj;
If you wanted to grant all users the ability to execute this function, you would execute the following:
grant execute on Find_Value to public;
Revoke Privileges on Functions/Procedures
Once you have granted execute privileges on a function or procedure, you may need to revoke these privileges from a user. To do this, you can execute a revoke command.
The syntax for the revoking privileges on a function or procedure is:
revoke execute on object from user;
If you wanted to revoke execute privileges on a function called Find_Value from a user named anderson, you would execute the following statement:
revoke execute on Find_Value from anderson;
If you had granted privileges to public (all users) and you wanted to revoke these privileges, you could execute the following statement:
revoke execute on Find_Value from public;