我们可以查看下LogParser的帮助文档,在Reference->Output Formats->SQL中,看了,我们就可以了解了。
先来看看,数据类型的匹配:
| Log Parser Data Type | New Table | Existing Table |
|---|---|---|
| INTEGER | int | int, bigint, smallint, tinyint, bit1 |
| REAL | real | real, decimal, float |
| STRING | varchar(n2) | varchar(n), nvarchar(n), char |
| TIMESTAMP | datetime | datetime, smalldatetime, date, time |
| NULL | varchar | any type |
下面,看看主要的参数:
server:指定数据库服务器的名字 Example:-server:10.0.3.162
database:指定导入到的数据库的名字(理解为sid) Example:-database:demodriver:ODBC驱动器名字 Example:-driver:"Oracle in OraDb10g_home1"
user:帐户名字 Example:-user:scott
Password:帐户密码 Example:-password:tiger
createtable:是否建立新表 Example:-createtable:on
实例:
C:\>LogParser -i:XML "select BMGID, ContentID, PacketID, to_string(SVCtype), to_string(contentTime), to_string(endTime), to_string(flow), to_string(orderID), to_string(pauseTime), to_string(sq), to_string(startTime), to_string(userID) into testlogparser from 1.xml" -o:SQL -server:10.0.3.162 -database:demo -username:scott -password:tiger -createTable:on -driver:"Oracle in OraDb10g_home1
完成之后我们就可以查看下:
SQL>select * from tab;
就可以在demo里发现我们新建的表testlogparser了。
你是不是又多了种将外部数据导入Oralce数据库的方法了呢!