[Python] How to extract the value from output of sybase sp_helpdb

Discussão em 'Python' iniciado por Stack, Junho 17, 2025.

  1. Stack

    Stack Membro Participativo

    I want to extract status of database so How is it possible using python script. I also write simple python code but i did not desire output. My requirement is extract this "trunc log on chkpt, mixed log and data".

    cmd = 'sp_helpdb pubs2' res = subprocess.getoutput(cmd) print(cmd)

    name db_size owner dbid created status


    pubs2 20.0 MB sa 4 Apr 13, 2005 trunc log on chkpt, mixed log and data (1 row affected) pubs2 device_fragments size usage created free kbytes


    master 10.0 MB data and log Apr 13 2005 10:29AM 2304 pubs_2_dev 10.0 MB data and log Apr 13 2005 10:33AM 9888

    device segment


    master default master logsegment master system pubs_2_dev default pubs_2_dev logsegment pubs_2_dev system pubs_2_dev titleseg1 pubs_2_dev titleseg2 pubs_2_dev titleseg3 pubs_2_dev titleseg4 pubs_2_dev titleseg5

    Continue reading...

Compartilhe esta Página