Example

Suppose you want to record, once every second, the reads, writes, and total I/O per device on an Adaptive Server that is monitored by the SMS1100 Monitor Server. You can use the following steps to record the data, create a table to accept the data, and then use the bcp utility to import the data into the table. In this example, the view data file that is created by Historical Server for the view is d1_1_device_io.

  1. Use isql to log in to Historical Server.

  2. Record the data by using the following commands:

    hs_create_recording_session SMS1100, 1
    
    go
    
    hs_create_view device_io,
    
        "device name", "value for sample", 
    
        "device reads", "value for sample",
    
        "device writes", "value for sample",
    
        "device i/o", "value for sample"
    
    go
    
    hs_initiate_recording
    
    go 
    
  3. Use isql to log in to Adaptive Server. Because the recording session contains only one view (“device_io”), create just one table in the pubs2 database to store data for that view by using the following Transact-SQL commands:

    use pubs2
    
    go
    
    create table device_io
    
    (
    
    sample_time          datetime         not null,
    
    device_name          varchar (255)    null,
    
    device_reads_val     int              null,
    
    device_writes_val    int              null,
    
    device_io_val        int              null,
    
    )
    
    go
    
  4. After the recording session is complete, you can use bcp to import data from the view’s data file into the database table. Use the following commands:

    bcp pubs2..device_io in d1_1_device_io -c 
     -e d1_1_device_io.err -U username 
     -P password -S server -t