-
Notifications
You must be signed in to change notification settings - Fork 5k
[oracle] Missing total.bytes field in tablespace datastream #39787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
5ec5122
4395915
6b89212
2e7a998
683b39d
2ce18ac
0873951
296ed24
f99a0a0
c90771f
f0d0229
4b5160d
d092845
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,31 +11,24 @@ import ( | |
| ) | ||
|
|
||
| type tempFreeSpace struct { | ||
| TablespaceName string | ||
| TablespaceSize sql.NullInt64 | ||
| UsedSpaceBytes sql.NullInt64 | ||
| FreeSpace sql.NullInt64 | ||
| } | ||
|
|
||
| func (d *tempFreeSpace) hash() string { | ||
| return d.TablespaceName | ||
| } | ||
|
|
||
| func (d *tempFreeSpace) eventKey() string { | ||
| return d.TablespaceName | ||
| TablespaceName string | ||
| TotalSpaceBytes sql.NullInt64 | ||
| UsedSpaceBytes sql.NullInt64 | ||
| FreeSpace sql.NullInt64 | ||
| } | ||
|
|
||
| func (e *tablespaceExtractor) tempFreeSpaceData(ctx context.Context) ([]tempFreeSpace, error) { | ||
| rows, err := e.db.QueryContext(ctx, "SELECT TABLESPACE_NAME, TABLESPACE_SIZE, ALLOCATED_SPACE, FREE_SPACE FROM DBA_TEMP_FREE_SPACE") | ||
| rows, err := e.db.QueryContext(ctx, `WITH sums AS ( SELECT (SELECT SUM(BYTES) FROM DBA_DATA_FILES) + (SELECT SUM(BYTES) FROM DBA_TEMP_FILES) AS TOTAL_SUM FROM dual ) SELECT t.TABLESPACE_NAME, s.TOTAL_SUM, t.ALLOCATED_SPACE, t.FREE_SPACE FROM DBA_TEMP_FREE_SPACE t, sums s `) | ||
|
||
| if err != nil { | ||
| return nil, fmt.Errorf("error executing query: %w", err) | ||
| } | ||
| defer rows.Close() | ||
|
|
||
| results := make([]tempFreeSpace, 0) | ||
|
|
||
| for rows.Next() { | ||
| dest := tempFreeSpace{} | ||
| if err = rows.Scan(&dest.TablespaceName, &dest.TablespaceSize, &dest.UsedSpaceBytes, &dest.FreeSpace); err != nil { | ||
| if err = rows.Scan(&dest.TablespaceName, &dest.TotalSpaceBytes, &dest.UsedSpaceBytes, &dest.FreeSpace); err != nil { | ||
| return nil, err | ||
| } | ||
| results = append(results, dest) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.